convtransformer
convtransformer copied to clipboard
Interactive inference fails on python 3.8.5
Interactive inference fails on python 3.8.5 (maybe also other versions).
python interactive.py -source_sentence "test this out" -path_checkpoint "models/checkpoint_best.pt" -data_bin "prep/"
| [en] dictionary: 48 types
| [en] dictionary: 48 types
Traceback (most recent call last):
File "interactive.py", line 186, in <module>
print(gen.generate(args.source_sentence))
File "interactive.py", line 155, in generate
translations = self.task.inference_step(self.generator, self.models, sample)
File "convtransformer/convtransformer/fairseq/tasks/fairseq_task.py", line 248, in inference_step
return generator.generate(models, sample, prefix_tokens=prefix_tokens)
File "~/anaconda3/envs/convtransformer/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 15, in decorate_context
return func(*args, **kwargs)
File "convtransformer/convtransformer/fairseq/sequence_generator.py", line 394, in generate
cand_scores, cand_indices, cand_beams = self.search.step(
File "convtransformer/convtransformer/fairseq/search.py", line 83, in step
torch.div(self.indices_buf, vocab_size, out=self.beams_buf)
RuntimeError: Integer division of tensors using div or / is no longer supported, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead.
There is a fix for this on the fairseq issues (https://github.com/pytorch/fairseq/issues/2460).
your python version is too high ~ try to inference with 3.6 or 3.7
@alphadl do you suggest that the fix that was suggested on the fairseq issues (pytorch/fairseq#2460) is wrong?