label-studio-ml-backend icon indicating copy to clipboard operation
label-studio-ml-backend copied to clipboard

problems running ml backend with data from localhost

Open rballachay-ecoation opened this issue 3 years ago • 3 comments

Hi there. I am new to label-studio-ml, just started using the tool today. I am trying to run the example mmdetection, and have run into a problem trying to run the model on the backend of label-studio running through my localhost. I have uploaded an image manually to labelstudio, and added the model from http://localhost:9091. When I go to run the automated labelling, I get the following traceback from label-studio:

[24/Aug/2022 22:53:50] "GET /data/upload/2/6c449796-0032078421520747-1657602370819-20220712-360-n1yNFk_left.jpg HTTP/1.1" 200 2083378
[2022-08-24 22:53:51,751] [ml.models::predict_tasks::171] [WARNING] Prediction not created for project  (id=1, url=http://localhost:9091): 500 Server Error: INTERNAL SERVER ERROR for url: http://localhost:9091/predict

To confirm that it was the request that was having problems, I ran the following from inside the server docker container:

requests.get('http://localhost:8083/data/upload/1/d2f932ea-0032078421520747-1657602370819-20220712-360-E-IfNo_right.jpg')

Traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 565, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8083): Max retries exceeded with url: /data/upload/1/d2f932ea-0032078421520747-1657602370819-20220712-360-E-IfNo_right.jpg (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7faab3919250>: Failed to establish a new connection: [Errno 111] Connection refused'))

And also ran the following (I landed on 172.17.0.1 from this link):

requests.get('http://172.17.0.1:8083/data/upload/1/d2f932ea-0032078421520747-1657602370819-20220712-360-E-IfNo_right.jpg')

which returned the following request:

b'{"id":"99370e89-a4b3-456e-87ff-d278c9b6021d","status_code":401,"version":"1.5.0post0","detail":"Authentication credentials were not provided.","exc_info":null}'

In order to solve this issue, I have added the following to the docker-compose.yml:

extra_hosts:
     - "localhost:172.17.0.1"

I'm not sure if this is the best solution, but it solved the problem for me

rballachay-ecoation avatar Aug 24 '22 23:08 rballachay-ecoation

Just wondering, is this the only solution? Is there some part that I am missing?

rballachay-ecoation avatar Aug 24 '22 23:08 rballachay-ecoation

I have also run into similar problem when trying to run simple_text_classifier. I solved the issue by adding environment variable LABEL_STUDIO_USE_REDIS=true to the docker-compose.yml.

phycause avatar Aug 27 '22 14:08 phycause

Hi @rballachay-ecoation

b'{"id":"99370e89-a4b3-456e-87ff-d278c9b6021d","status_code":401,"version":"1.5.0post0","detail":"Authentication credentials were not provided.","exc_info":null}'

This error tells that you are not authorized in Label Studio. You need to add Access Token to your request. You can find it in Account & Settings of your Label Studio instance. Check our documentation.

KonstantinKorotaev avatar Aug 29 '22 07:08 KonstantinKorotaev