OpenNMT Forum

Empty reply from opennmt server -using docker containers


(Kishor Kp) #1


I could download and run the Opennmt server on ubuntu. When I run the following the curl command :
curl -v -H “Content-Type: application/json” -X POST -d ‘[{ “src” : “Hello World” }]’ http://IP_address:7784/translator/translate

I get the following response

The image downloaded from docker hub has been model using 13 epoch stages.

What am I missing here ?

Thank You,

How to run the translation server on the Docker Image
(Guillaume Klein) #2


How did you run the translation server? If using Docker, did you expose the port?

(Kishor Kp) #3


i ran the docker server using the following command:
sudo docker run -td -p 7784:7784 opennmt/opennmt


(Kishor Kp) #4


I am getting a empty response from the server again:

The container is running :

There is empty reply from server when models are requested:

I am really unable to make out as to why there is empty response from server

Please assist me to resolve this issue.

Thank You,

(Guillaume Klein) #5

You are just running the Docker image not the translation server. I already posted the command line to run the server script and display its options:

docker run --entrypoint th opennmt/opennmt tools/rest_translation_server.lua -h

And here is a high level documentation of the REST:

And finally some Docker-specific considerations:

  • you should expose the port when running the image
  • you should mount any files that is required by the translation

There is all the required information here, please try to work it out.

(Kishor Kp) #6


th tools/rest_translation_server.lua -model …/Recipes/baseline-1M-enfr/exp/model-baseline-1M-enfr_epoch13_3.44.t7 -gpuid 1 -host … -port -case_feature -bpe_model …

what is th command here ?

Thank You,

(Kishor Kp) #7


I run the suggested above command which resulted in the below error:

Please assist me in resolving this error.

Thank You,

(Kishor Kp) #8


When I sent a request to the downloaded docker image using curl I get an empty response from the server. So from the link “” I am trying to run following commands in order to check if the curl return an response .

  1. luarocks install restserver-xavante
  2. th tools/rest_translation_server.lua -model …/Recipes/baseline-1M-enfr/exp/model-baseline-1M-enfr_epoch13_3.44.t7 -gpuid 1 -host … -port -case_feature -bpe_model …
  3. curl -v -H “Content-Type: application/json” -X POST -d ‘[{ “src” : “Hello World” }]’ http://IP_address:7784/translator/translate

I am struck in the 2nd command above Please assist with the below

I am trying to run the following command, but unable t find the value for the options:
th tools/rest_translation_server.lua -model …/Recipes/baseline-1M-enfr/exp/model-baseline-1M-enfr_epoch13_3.44.t7 -gpuid 1 -host … -port -case_feature -bpe_model

I am unable to find the model value and bpe_model value in the above command…
Could someone please assist me to find this ?

I guess I am in the correct path of running a translation server .
Please clarify if the order of commands to run the translation server is correct ?

I also assume that empty response from the translation server could be resolved by the above steps

Thank You,

(Guillaume Klein) #9

Here is a full example using a pretrained model. Please run it and adapt it to your model.

Download the model:

wget && tar xf wmt-ende_l2-h1024-bpe32k_release.tar.gz

Run the server:

docker run --rm -v $PWD:/data -p 7784:7784 --entrypoint th opennmt/opennmt:latest tools/rest_translation_server.lua -host -model /data/model-ende_epoch7_5.55_release.l /data/train-ende.bpe32000 -mode aggressive -segment_case -joiner_annotate

Send a request:

curl -v -H "Content-Type: application/json" -X POST -d '[{"src": "Hello World!"}]'

If you are still unable to setup a simple server, consider posting to #marketplace and pay people to assist you.

(Guillaume Klein) closed #10