OpenNMT

Cross-platform use of models and checkpoints for CTranslate2

Is my understanding of the CTranslate2 documentation correct that I cannot convert checkpoints from a Linux training in a Windows environment with the export --output ctranslate2 option, nor can I access a model.bin created in Linux in Windows?

The documentation only indicates there is no prebuilt binaries for Windows, but the models should be cross-platform (*). So if you can compile CTranslate2 on Windows, you should be able to use models produced on Linux.

Are you having an issue?

(*) The only requirement is that the platform that converted the model and the one that loads the model should use the same endianness.

Hi Guillaume, Thanks for your reply. I built with CMake and ended up with a translate.exe file. If I run it with the following command:
translate.exe --model .\model.bin --device cpu --src .\test.sp --out .\out.sp.
the file does not give any output but does not produce an error message. If I run the exe file with the same arguments in the Visual Studio debugger I get the following runtime error messages. I have little experience of C++ so I am just starting to track them down.


‘translate.exe’ (Win32): Loaded ‘C:\Users\lingo\source\repos\CTranslate2\build3\testbed3\translate.exe’. Symbols loaded.
‘translate.exe’ (Win32): Loaded ‘C:\Windows\System32\ntdll.dll’.
‘translate.exe’ (Win32): Loaded ‘C:\Windows\System32\kernel32.dll’.
‘translate.exe’ (Win32): Loaded ‘C:\Windows\System32\KernelBase.dll’.
‘translate.exe’ (Win32): Loaded ‘C:\Users\lingo\source\repos\CTranslate2\build3\testbed3\ctranslate2.dll’. Symbols loaded.
‘translate.exe’ (Win32): Loaded ‘C:\Windows\System32\msvcp140d.dll’.
‘translate.exe’ (Win32): Loaded ‘C:\Windows\System32\vcruntime140d.dll’.
‘translate.exe’ (Win32): Loaded ‘C:\Windows\System32\vcruntime140_1d.dll’.
‘translate.exe’ (Win32): Loaded ‘C:\Windows\System32\ucrtbased.dll’.
‘translate.exe’ (Win32): Loaded ‘C:\Users\lingo\source\repos\CTranslate2\build3\testbed3\libiomp5md.dll’.
‘translate.exe’ (Win32): Loaded ‘C:\Windows\System32\ucrtbase.dll’.
‘translate.exe’ (Win32): Loaded ‘C:\Windows\System32\vcruntime140.dll’.
The thread 0x32fc has exited with code 0 (0x0).
Exception thrown at 0x00007FFC4F2E467C in translate.exe: Microsoft C++ exception: cxxopts::missing_argument_exception at memory location 0x00000091BE75C250.
Unhandled exception at 0x00007FFC4F2E467C in translate.exe: Microsoft C++ exception: cxxopts::missing_argument_exception at memory location 0x00000091BE75C250.

Exception thrown at 0x00007FFC4F2E467C in translate.exe: Microsoft C++ exception: std::runtime_error at memory location 0x00000091BE75C1E0.
Unhandled exception at 0x00007FFC4F2E467C in translate.exe: Microsoft C++ exception: std::runtime_error at memory location 0x00000091BE75C1E0.

Exception thrown at 0x00007FFBF4834E93 (msvcp140d.dll) in translate.exe: 0xC0000005: Access violation writing location 0x0000000000000008.

Unhandled exception at 0x00007FFBF4834E93 (msvcp140d.dll) in translate.exe: 0xC0000005: Access violation writing location 0x0000000000000008.

Exception thrown at 0x00007FFBF4834E93 (msvcp140d.dll) in translate.exe: 0xC0000005: Access violation writing location 0x0000000000000008.
Unhandled exception at 0x00007FFBF4834E93 (msvcp140d.dll) in translate.exe: 0xC0000005: Access violation writing location 0x0000000000000008.

The thread 0x40d8 has exited with code -1073741510 (0xc000013a).
The thread 0x22e8 has exited with code -1073741510 (0xc000013a).
The thread 0x378c has exited with code -1073741510 (0xc000013a).
The program ‘[14216] translate.exe’ has exited with code -1073741510 (0xc000013a).

Are you sure you used the same arguments? I see the following exception in the log:

cxxopts::missing_argument_exception

which indicates that an option did not get its value.

I am attaching the debugger window with what I assume to be the “essential” arguments. I had spotted the missing argument exception. I wondered about whether the ModelReader could not access “model.bin” generated in Linux and that was the cause.

model.bin should not be passed directly. You should pass the directory that contains model.bin and the vocabulary files.

My mistake, and that was it. I now have Tagalog output (still sentencepieced) from my English input and can go further with my Windows project. Great support, thanks, and thanks to @panosk. You’ve saved me a lot of head scratching :slight_smile: