qnguyen3 / chat-with-mlx

An all-in-one LLMs Chat UI for Apple Silicon Mac using MLX Framework.
https://twitter.com/stablequan
MIT License
1.49k stars 134 forks source link

httpx.ReadError: [Errno 54] Connection reset by peer #69

Open Lindawandouyi opened 8 months ago

Lindawandouyi commented 8 months ago

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/opt/anaconda3/lib/python3.11/site-packages/httpx/_transports/default.py", line 67, in map_httpcore_exceptions yield File "/opt/anaconda3/lib/python3.11/site-packages/httpx/_transports/default.py", line 111, in iter for part in self._httpcore_stream: File "/opt/anaconda3/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 361, in iter for part in self._stream: File "/opt/anaconda3/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 337, in iter raise exc File "/opt/anaconda3/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 329, in iter for chunk in self._connection._receive_response_body(**kwargs): File "/opt/anaconda3/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 198, in _receive_response_body event = self._receive_event(timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 212, in _receive_event data = self._network_stream.read( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 124, in read with map_exceptions(exc_map): File "/opt/anaconda3/lib/python3.11/contextlib.py", line 158, in exit self.gen.throw(typ, value, traceback) File "/opt/anaconda3/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions raise to_exc(exc) from exc httpcore.ReadError: [Errno 54] Connection reset by peer

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/opt/anaconda3/lib/python3.11/site-packages/gradio/queueing.py", line 495, in call_prediction output = await route_utils.call_process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/gradio/route_utils.py", line 235, in call_process_api output = await app.get_blocks().process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/gradio/blocks.py", line 1627, in process_api result = await self.call_function( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/gradio/blocks.py", line 1185, in call_function prediction = await utils.async_iteration(iterator) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/gradio/utils.py", line 514, in async_iteration return await iterator.anext() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/gradio/utils.py", line 640, in asyncgen_wrapper response = await iterator.anext() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/gradio/chat_interface.py", line 490, in _stream_fn first_response = await async_iteration(generator) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/gradio/utils.py", line 514, in async_iteration return await iterator.anext() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/gradio/utils.py", line 507, in anext return await anyio.to_thread.run_sync( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2134, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 851, in run result = context.run(func, args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/gradio/utils.py", line 490, in run_sync_iterator_async return next(iterator) ^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/chat_with_mlx/app.py", line 166, in chatbot response = client.chat.completions.create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/openai/_utils/_utils.py", line 275, in wrapper return func(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/openai/resources/chat/completions.py", line 663, in create return self._post( ^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/openai/_base_client.py", line 1200, in post return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/openai/_base_client.py", line 889, in request return self._request( ^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/openai/_base_client.py", line 965, in _request return self._retry_request( ^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/openai/_base_client.py", line 1013, in _retry_request return self._request( ^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/openai/_base_client.py", line 965, in _request return self._retry_request( ^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/openai/_base_client.py", line 1013, in _retry_request return self._request( ^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/openai/_base_client.py", line 977, in _request err.response.read() File "/opt/anaconda3/lib/python3.11/site-packages/httpx/_models.py", line 811, in read self._content = b"".join(self.iter_bytes()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/httpx/_models.py", line 829, in iter_bytes for raw_bytes in self.iter_raw(): File "/opt/anaconda3/lib/python3.11/site-packages/httpx/_models.py", line 887, in iter_raw for raw_stream_bytes in self.stream: File "/opt/anaconda3/lib/python3.11/site-packages/httpx/_client.py", line 124, in iter for chunk in self._stream: File "/opt/anaconda3/lib/python3.11/site-packages/httpx/_transports/default.py", line 110, in iter with map_httpcore_exceptions(): File "/opt/anaconda3/lib/python3.11/contextlib.py", line 158, in exit self.gen.throw(typ, value, traceback) File "/opt/anaconda3/lib/python3.11/site-packages/httpx/_transports/default.py", line 84, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ReadError: [Errno 54] Connection reset by peer