ageron / ageron/handson-ml3

19_training_and_deploying_at_scale.ipynb error

Open
#22 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
14.2k
Forks
5.3k
PR merge metrics
No merged PRs in 30d

Description

I tried to run the subject notebook in Colab and received the below error at [this section]. (https://colab.research.google.com/github/ageron/handson-ml3/blob/main/19_training_and_deploying_at_scale.ipynb#scrollTo=Querying_TF_Serving_through_the_REST_API). Please help. Thanks.

Codes caused the error:

`import requests

server_url = "http://localhost:8501/v1/models/my_mnist_model:predict"
response = requests.post(server_url, data=request_json)
response.raise_for_status() # raise an exception in case of error
response = response.json()`

Error messages:
---------------------------------------------------------------------------
ConnectionRefusedError Traceback (most recent call last)
[/usr/local/lib/python3.7/dist-packages/urllib3/connection.py](https://localhost:8080/#) in _new_conn(self)
158 conn = connection.create_connection(
--> 159 (self._dns_host, self.port), self.timeout, **extra_kw)
160

19 frames
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

NewConnectionError Traceback (most recent call last)
NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

MaxRetryError Traceback (most recent call last)
MaxRetryError: HTTPConnectionPool(host='localhost', port=8501): Max retries exceeded with url: /v1/models/my_mnist_model:predict (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

ConnectionError Traceback (most recent call last)
[/usr/local/lib/python3.7/dist-packages/requests/adapters.py](https://localhost:8080/#) in send(self, request, stream, timeout, verify, cert, proxies)
514 raise SSLError(e, request=request)
515
--> 516 raise ConnectionError(e, request=request)
517
518 except ClosedPoolError as e:

ConnectionError: HTTPConnectionPool(host='localhost', port=8501): Max retries exceeded with url: /v1/models/my_mnist_model:predict (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with 19_training_and_deploying_at_scale.ipynb and the “Querying TF Serving through the REST API” section, then inspect the preceding serving setup and run the shown request in Colab. Done means that the notebook can reach the configured TF Serving endpoint and the request no longer raises ConnectionRefusedError.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python, tensorflow
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.