OpenNMT Forum

Ctranslate2 + model conversion

Hi, I have tried running the converter command from the package cloned from Github and from the downloaded zip file. In both cases Python is not finding ctranslate2 although it is clearly there. All the dependencies are complied with. Any ideas appreciated. I have also run the command with separating periods instead of slashes.
C:\Users\Terence\AppData\Local\Programs\Python\Python36\python.exe: Error while finding module specification for ‘C:\Users\Terence\Documents\GitHub\CTranslate2\python\ctranslate2\bin\opennmt_tf_converter.py’ (ModuleNotFoundError: No module named ‘C:\Users\Terence\Documents\GitHub\CTranslate2\python\ctranslate2\bin\opennmt_tf_converter’)

Did you run it exactly as shown in the readme and from the same location? https://github.com/OpenNMT/CTranslate2/blob/master/README.md#converting-models

Is there a specific location on Windows 10 into which we must clone from Github? I have run the command exactly as show in README.md. My “python” path is set to C:\Users\Terence\AppData\Local\Programs\Python\Python36. I have a working TensorFlow installation on this machine and other running Python programs. I assume there is one small thing I have overlooked :slight_smile:

It only expects the command python -m ctranslate2.bin.opennmt_tf_converter to be run from the python/ directory. Not sure if there is something specific about Windows.

Thanks. I will play around with this until I (hopefully) get something working. My current interest is getting OpenNMT implementations running on Windows 10. I’ve been quite successful with OpenNMT-tf (and @ymoslem has with OpenNMT-py). Ctranslate2 looked like a good “next challenge” :slight_smile:

Using the full path C:\Users\Terence\Documents\GitHub\CTranslate2\python>python -m ctranslate2.bin.opennmt_tf_converter --model_path C:\tf_models\serving\ned2eng --output_dir ned2eng_ctranslate2 --model_spec TransformerBase
got this firing off successfully.

However, opennmt_tf.py comes to a halt at line 37 because tensorflow_addons are not yet available for Windows 10 (see https://pypi.org/project/tensorflow-addons).

You could run the script with TensorFlow 1.14 installed. The only limitation is that you will not be able to convert SavedModel that were exported by OpenNMT-tf 2.0 (checkpoints will work fine).