marcotcr / checklist

Beyond Accuracy: Behavioral Testing of NLP models with CheckList
MIT License
2.01k stars 204 forks source link

IndexError: tensors used as indices must be long, byte or bool tensors #93

Closed Mr-Pan-Da closed 3 years ago

Mr-Pan-Da commented 3 years ago

Thank you for your useful work!

While running the tutorials: ret = editor.template('This is {a:adj} {mask}.', remove_duplicates=True) output: ~\anaconda3\envs\checklist\lib\site-packages\checklist\text_generation.py in unmask(self, text_with_mask, beam_size, candidates) 183 else: 184 if forbid: --> 185 v, top_preds = torch.topk(outputs[i, masked[size], self.with_space], beam_size + 10) 186 top_preds = self.with_space[top_preds] 187 else: IndexError: tensors used as indices must be long, byte or bool tensors

Could you tell me how to solve this problem?

env: python=3.6 torch=1.8.1 cuda=11.1 checklist=0.0.10

marcotcr commented 3 years ago

I can't replicate, but it seems like you're using an older version (perhaps you installed from pypi rather than from source). I just updated the pypi version to track the repo, so please try updating to 0.0.11. If that doesn't work, what is your OS?

Mr-Pan-Da commented 3 years ago

It works after updating checklist version from 0.0.10 to 0.0.11. Thanks a lot!