OpenNMT Forum

Stand-alone OpenNMT

Hi Colleagues!

If I want to have a stand-alone / compiled version of OpenNMT that does not require any manual preparations / installations on the target machine, and no Internet connection, what are my options to achieve this?

Note: My current implementation depends on a Localhost REST API which is perfect for most cases, but not for the case I mentioned above as the client wants be able to move the whole thing as one package without any prior (manual) preparation or installation of dependencies.

Many thanks for insights!

Kind regards,
Yasmin

Hi,

Is Docker pre-installed or is it at least a dependency that is acceptable to install? If yes, that’s a good way to package complex applications like OpenNMT.

Thanks, Guillaume, for the tip about Docker. I will make sure I use it for other cases. As for the case related to this post, I do not think Docker will be installed.

Dear Colleagues,

I have managed to achieve progress using PyInstaller + NSIS and the PyTorch version of OpenNMT.

Purpose:

Creating an executable version of OpenNMT-py that requires the minimal technical experience to install and use, and no Internet connection.

Outcome:

A proof-of-concept version can be downloaded at: https://s3.us-west-2.amazonaws.com/opennmt-gui/translate-gui.exe

Tested on Windows 7 and 10. Support for 64bit version of Windows only (PyTorch works on Python 64bit only).

How it works:

  • After launching the installer, it will copy the files to the “Program Files” folder. When the installer finishes, there will be a shortcut on the Desktop called “translate-gui”.

  • Running the shortcut “translate-gui” (which refers to translate-gui.exe), this window opens.

OpenNMT-gui

  1. Select the source file (*.txt)
  2. Select the model file (*.pt)
  3. Click “Translate”.
  • If everything works fine, it should create the translation file “youtranslation.txt” on the Desktop.

OpenNMT-gui-success

Uninstallation:

To uninstall, simply delete the folder “translate-gui” from the “Program Files” folder.

Changes in the OpenNMT-py code:

Simple use of the same arguments; no serious changes.

1- translate.py - assigning values from the GUI to these variables:

opt.src (source file path - string)
opt.models (model file path - list of strings)
opt.output (target file path - string)

2- onmt/opts.py

For the arguments -src and -model, changing the attribute “required=True” to “required=False”

So that is it. This is for the local version. My next test should be for the server version.

More details can be found here.

3 Likes

I have now installed this on my Windows 10 laptop and can confirm it all works nicely!

1 Like