OpenNMT-py 2.0 onmt_xxxx vs xxx.py

Hi

Srry I have limited python/linux knowledge.

Looks like old version xxx.py programs (i.e.translate.py or server.py) in version 2.0 are ported as bash onmnt_xxx executables in python/anaconda bin directories (i.e. onmt_translate or onmt_sever).

Ineed If I run any of the xxx.py I got a

ModuleNotFoundError: No module named 'torch.cuda.amp'

Does it mean we cannot run the old py programs anymore? In the docs, for instance entries for build vocabulary, train, translate or server sitll the python programs are documented there (i.e. in Train — OpenNMT-py documentation)

But not sure if it is just a downlevel doc.

So do I have an installation issue, these python programs are deprecated or still valid? Any special reason?

Thanks in advance
Have a nice day!
Miguel

Srry I have limited python/linux knowledge.

You might want to get a bit more of such knowledge, it’s not that difficult and will help you a lot if you intend to keep experimenting with frameworks like OpenNMT.

For your specific question, it depends on the way you retrieved/installed OpenNMT-py.
If installed via pip or conda, you should indeed have the entry points (onmt_translate, etc.) in your path and should be able to execute those. These entry points are just wrapping the scripts, and are defined here:

If you want to execute the scripts, you might want to clone the github repo to a folder of your choice, cd to this folder and execute the scripts.

ModuleNotFoundError: No module named ‘torch.cuda.amp’

I think your issue here is just that you have an older version of torch, which did not have AMP embedded yet.

Hi François, thanks a lot for your answer. Excuse me if I missing something here.

I am able to run onmt_translate or onmt_server or omnt_train. No special issues so far.

What I would like to know if the “old” pyhton scripts (translate.py or server.py) are still valid or deprecate. And I ask you this, because documentations still is related to python script but I get an error and I would like to know if I have or not an install issue.

Notice in Translate — OpenNMT-py documentation how starts.

I installed opentmt-py 2.0 no very long ago (as far I recall from the sources).
Hope I did not misunderstood your answer.
Thanks again.
Have a nice day!
Miguel

These are the same thing.
onmt_translate == translate.py
onmt_server == server.py

Read my initial reply again. The error you get is probably just from a pytorch version mismatch. Which version do you have installed?

Hi @francoishernandez

Thanks a lot for your help. In one case I was using a wrong conda environment in a another case, I update my docker pytorch/pytorch image and then install latest opennmt. Looks like I have been able to fix the issue. I have installed latest versions (I think).

Have a nice day!
Miguel Canals

Thanks alot