{‘error’: “Error: ‘TextMultiField’ object has no attribute ‘is_target’”, ‘status’: ‘error’}


I have the following client code which gets response from server at port 7790.

import requests

def translate_de_en():
** url = “”**
** ans = ‘y’**
** while ans is ‘y’ :**
** source = input("Enter the sentence ==> ")**

** if not source:**
** #print("")**
** return “”**

** headers = {‘content-type’:‘application/json’}**

** params = [{“src”:source, “id”:1}]**

** response = requests.post(url, json=params, headers=headers)**

** target = response.json()**

** print(target)**

** #print(target[0][0][“tgt”])**

** print(response)**

** ans = input(“Do you want to continue: y or n ?”)**

if name == “main”:
** translate_de_en()**

The following is the response from the server:
**administrator@:~/OpenNMT$ python3 translate_de_en.py **
Enter the sentence ==> hallo welt
{‘error’: “Error: ‘TextMultiField’ object has no attribute ‘is_target’”, ‘status’: ‘error’}
<Response [200]>
Do you want to continue: y or n ?

I had done the following to upgrade Pytorch/torchtext
(ref : How to get response from the running Server.py at port 7790)

sudo python3 -m pip install --upgrade git+https://github.com/pytorch/text

initially the issue got resolved. But after every reboot, the issue started appearing again.Now the issue persists.

Could someone please give a permanent solution to this.

Than You,

Don’t post several times the same issue.

Your issue stems from the fact you are using the pre-trained model from the website.
At that time it was a previous version of the codebase without multifields.

IIRC we made sure translate.py was back compatible but we may have not modified the server accordingly.

I suggest you trin your own model if you want to use the server.
Since it’s for a POC you don’t need to train very long.


Dear Vincent,

I apologize for posting it again.
As the issue could not solved with a permanent solution, I posted it again .