An error was encountered while running the pre training model

I am using the pretrained En-De model with the following command,

python -model wmt_ende_sp/model/ -src data/test.en -tgt data/ -verbose

and I got the following error,

Traceback (most recent call last):
  File "D:\anaconda\envs\opennmt\Scripts\", line 33, in <module>
    sys.exit(load_entry_point('OpenNMT-py', 'console_scripts', 'onmt_translate')())
  File "f:\desktop\opennmt-py\opennmt-py-master\onmt\bin\", line 60, in main
  File "f:\desktop\opennmt-py\opennmt-py-master\onmt\bin\", line 23, in translate
    translator = build_translator(opt, logger=logger,
  File "f:\desktop\opennmt-py\opennmt-py-master\onmt\translate\", line 31, in build_translator
    vocabs, model, model_opt = load_test_model(opt)
  File "f:\desktop\opennmt-py\opennmt-py-master\onmt\", line 90, in load_test_model
    checkpoint = torch.load(model_path,
  File "D:\anaconda\envs\opennmt\lib\site-packages\torch\", line 712, in load
    return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
  File "D:\anaconda\envs\opennmt\lib\site-packages\torch\", line 1049, in _load
    result = unpickler.load()
  File "D:\anaconda\envs\opennmt\lib\site-packages\torch\", line 1042, in find_class
    return super().find_class(mod_name, name)
ModuleNotFoundError: No module named 'onmt.inputters.text_dataset'

In addition, I want to know how to use the SentencePiece model. I won’t use it.
I hope you can help me.

You probably need to convert the checkpoint to OpenNMT-py v3, as I don’t think that tutorial’s checkpoints have been updated/converted.

There’s a script in the OpenNMT-py Repo which can do that, or you can downgrade the version of OpenNMT-py to v2 if it’s too much grief.

1 Like

This is the right answer.
Also, I will release a new EN-DE model in the early days of 2023.

Thank you very much, I will try

I just released a new v3 model.

Scores are way higher than the paper replication because it was trained on more data.

However no back translation has been used for this model.

You need to use the pyonmttok package with the BPE model provided on the same page.

1 Like