neulab / knn-transformers

PyTorch + HuggingFace code for RetoMaton: "Neuro-Symbolic Language Modeling with Automaton-augmented Retrieval" (ICML 2022), including an implementation of kNN-LM and kNN-MT
MIT License
269 stars 22 forks source link

Got Error when running kNN-MT with T5-base #10

Closed vhientran closed 1 year ago

vhientran commented 1 year ago

Hi @urialon ,

Thanks for releasing your interesting source code. Following your guidance, I have tried to run kNN-MT when to evaluate the T5-base model. Here is the error image. The error is about "OverflowError: out of range integral type conversion attempted". I tried to increase the max_target_length (from 128 to 512, 1024) but still got error. What should I do to fix it? Thank you for your help!

vhientran commented 1 year ago

I fixed it by replacing the token id (-100) to the padding token id (0). Thanks!

urialon commented 1 year ago

Thanks for letting me know, I'm happy to hear that you managed to get it to work!