translation_server.lua loads the model OK and goes on to successfully initialize the server at tcp://127.0.0.1:5556 and the server then crashes with the message:
/home/tel34/torch/install/luajit:[string “zmq.nobj.ffi.lua”]: 1352: usr/lib/x86_64-linux-gnu/libzqm.so undefined symbol zmq_recmsg.
Has anybody else met this and dealt with it successfully?
You seem to have followed this tutorial:
so hopefully @netxiao can pass by and give you some guidance.
This would be appreciated because I’m stuck here after the server is initialized. I’m also puzzled that various grep and find commands fail to locate the file “zmq.nobj.ffi.lua” or the string “zmq_recvmsg” on my system.
sudo apt-get install libzmq5
No luck here. I get the message “Unable to locate package libzmq5”.
Quite frustrating as I’ve got several translation servers I coded in Java happily working away out there in the world I’ve got the translation engine working fine and have built several models, but the reality is we need a server set-up to present the output in a useful way to third parties.
Are you with the latest Ubuntu version ?
Sorry for not specifying. I’m still using Ubuntu 14.4. All the other OpenNMT stuff works fine with 14.4.
Try a search in Synaptic, to see if the more recent libzmq of your Ubuntu version is still to be installed. After my own installation of ONMT, I am with both libzmq1 and libzmq5 installed. I don’t remember when each of them was installed, and why. At some steps, I did several tests before succeeding…
I had similar problem with initializing the server - zeromq didn’t work with the Lua5.2. version.
After struggling to fix the binding of zeromq, I stumbled upon json’s requirements issues. Installed cjson but still couldn’t launch the translation server. Fixed the json as well and then I tried to do some simple requests - without any luck.
So, finally I wrote my own server using waffle (https://github.com/benglard/waffle). Due to my requirements I also used xmlrpc (after some modifications) from this package: https://github.com/manoelcampos/LuaXML.
It works like a charm and can be restricted for external access or only for internal access. Maybe you can consider such a solution in the future development of OpenNMT.
If anyone is interested I can give some code sample and explain in detail my solution.
I’d be interested to see your approach and solution, Dimitar. Cheers!
I’d also be interested to see a code sample for a solution that is proven to work - thanks for offering. So far I have struggled with translation_server.lua and rest_translation_server.lua, in both case seemingly due to not having all the dependencies.
If you are ready to try rest_translation server.lua (Pull request pending review #139)
here is the usage:
luarocks install restserver-xavante
Look at the top of rest_translation_server.lua for a syntax example
same for a curl example
Main difference vs the zmq version:
You send plain text, it will tokenize, translate, detokenize
response is in json, so you need to know what to do with it.
Having done a fresh install on a new server, I had to look back to some comments I posted previously on this forum to succeed. Here is the exact procedure working for me, to make the server properly running:
sudo apt-get install libzmq1 sudo apt-get install libzmq-dev luarocks install lua-zmq ZEROMQ_LIBDIR=/usr/lib/x86_64-linux-gnu/ ZEROMQ_INCDIR=/usr/include luarocks install dkjson
Hope it will also works for you…
@vince62s rest_translation_server.lua is set up but when I run it with options following the order given at the top of your file it complains about -model being an invalid argument (although this is a functioning model under translate.lua) and also asks me to specify the mode for tokenize.lua. Is this also expected on the command line, if so in any particular order?
@tel34 - what is the exact log you have? the fact that he asks for mode for
tokenize.lua is just because when cmdline parse fail, it displays the help file - so you do not need to worry (except if you did not use default tokenization options).
There is no order in the commandline.
I suspect I am causing this problem myself.
rest_translation_server.lua requires ‘tools/utils/tokenizer’ which my system does not have. I decided to use ‘tools/tokenize.lua’ and this is clearly the root cause of my trouble. What rock do I need to install to get tokenizer.lua into ‘tools/utils’?
The rock is not shipped with tools as of now. Could you work with a cloned repository instead after removing the
Would removing the onmt rock result in the removal of all the data directories I have created under the ~/OpenNMT directory? Sorry for the obvious question but most of my programming experience has been with Java and I am quite new to the Lua way. All I really want is to get a working server (be it translation_server.lua or rest_translation_server.lua). I have followed all the instructions given to me in this thread to the letter and I still have the problem I stated when I started.
No, removing the rock will only remove the OpenNMT library from the system.