You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.
I trained a model with OpenNMT with pytorch 0.4. I would like to load the trained model in c++ and translate an input string with it. Can I do that with this version of CTranslate? When I use torch.save in OpenNMT to save the model, I get a pt file and when I try to load it with a small test script that I was able to compile I just get this error:
undefined object=176816768
$ Error: Assertion `0' failed. at /data/esther/Projects/G2P/lts_experiments/scripts/OpenNMT-CTranslate/src/th/Obj.cc:400
I did notice the example in the Readme file shows a model with a t7 extension, so maybe it is not compatible? Any ideas on how to make them compatible?
Command used to compile:
g++ -O3 -std=c++11 -o test_translate test_translate.cc -IOpenNMT-CTranslate/include -IOpenNMT-CTranslate/lib/TH -IOpenNMT/lib/tokenizer/include -I/usr/include/eigen3 -LOpenNMT-CTranslate/build -lonmt
g++ version 4.8.5
CentOS 7
The text was updated successfully, but these errors were encountered:
No, unfortunately the implementation was designed to support OpenNMT LuaTorch models only. The CTranslate project predates the release of PyTorch itself which uses a very different model serialization logic.
Ok, that is too bad. I have been trying to find a fairly simple C++ interface to load a model and translate. I have been unable so far to compile the latest caffe2 sources, otherwise I would try to export it to that.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I trained a model with OpenNMT with pytorch 0.4. I would like to load the trained model in c++ and translate an input string with it. Can I do that with this version of CTranslate? When I use torch.save in OpenNMT to save the model, I get a pt file and when I try to load it with a small test script that I was able to compile I just get this error:
undefined object=176816768
$ Error: Assertion `0' failed. at /data/esther/Projects/G2P/lts_experiments/scripts/OpenNMT-CTranslate/src/th/Obj.cc:400
I did notice the example in the Readme file shows a model with a t7 extension, so maybe it is not compatible? Any ideas on how to make them compatible?
Command used to compile:
g++ -O3 -std=c++11 -o test_translate test_translate.cc -IOpenNMT-CTranslate/include -IOpenNMT-CTranslate/lib/TH -IOpenNMT/lib/tokenizer/include -I/usr/include/eigen3 -LOpenNMT-CTranslate/build -lonmt
g++ version 4.8.5
CentOS 7
The text was updated successfully, but these errors were encountered: