OpenNMT / OpenNMT-py

Open Source Neural Machine Translation and (Large) Language Models in PyTorch
https://opennmt.net/
MIT License
6.73k stars 2.25k forks source link

Update misc.py to prevent a runtime crash #2592

Closed royshil closed 3 months ago

royshil commented 3 months ago

Without this change I'm getting a crash e.g.

  File "C:\Users\...\AppData\Local\Programs\Python\Python312\Lib\site-packages\onmt\transforms\misc.py", line 56, in apply
    or len(example["tgt"]) > self.tgt_seq_length - 2
       ^^^^^^^^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()
vince62s commented 3 months ago

Please read the README of the project, we are no longer supporting OpenNMT-py and switching to https://github.com/eole-nlp/eole I suggest you to switch to eole if you intend to get support in the future.