sugarforever / chat-ollama

ChatOllama is an open source chatbot based on LLMs. It supports a wide range of language models, and knowledge base management.
MIT License
2.56k stars 395 forks source link

部署peanut-shell 后台报错 #445

Open jia-zhen-yu opened 3 months ago

jia-zhen-yu commented 3 months ago

联网的时候是可以用的,但是在内网就会报错 3cca47c899cc72df951da2bbd8524fe

tianKai333 commented 3 months ago

一样的问题,查看peanut-shell的日志,发现以下错误信息

2024-05-15T08:44:29.535996373Z ERROR:    Exception in ASGI application
2024-05-15T08:44:29.536016075Z Traceback (most recent call last):
2024-05-15T08:44:29.536021844Z   File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 198, in _new_conn
2024-05-15T08:44:29.536026397Z     sock = connection.create_connection(
2024-05-15T08:44:29.536030300Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536034115Z   File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection
2024-05-15T08:44:29.536038338Z     raise err
2024-05-15T08:44:29.536042002Z   File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 73, in create_connection
2024-05-15T08:44:29.536046131Z     sock.connect(sa)
2024-05-15T08:44:29.536049771Z TimeoutError: timed out
2024-05-15T08:44:29.536053593Z 
2024-05-15T08:44:29.536057239Z The above exception was the direct cause of the following exception:
2024-05-15T08:44:29.536061174Z 
2024-05-15T08:44:29.536064767Z Traceback (most recent call last):
2024-05-15T08:44:29.536068521Z   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 793, in urlopen
2024-05-15T08:44:29.536072595Z     response = self._make_request(
2024-05-15T08:44:29.536076313Z                ^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536080019Z   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 491, in _make_request
2024-05-15T08:44:29.536084152Z     raise new_e
2024-05-15T08:44:29.536088417Z   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 467, in _make_request
2024-05-15T08:44:29.536092562Z     self._validate_conn(conn)
2024-05-15T08:44:29.536096270Z   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1099, in _validate_conn
2024-05-15T08:44:29.536100452Z     conn.connect()
2024-05-15T08:44:29.536104084Z   File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 616, in connect
2024-05-15T08:44:29.536108181Z     self.sock = sock = self._new_conn()
2024-05-15T08:44:29.536112005Z                        ^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536115870Z   File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 207, in _new_conn
2024-05-15T08:44:29.536119969Z     raise ConnectTimeoutError(
2024-05-15T08:44:29.536125501Z urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x7fe5fd312790>, 'Connection to huggingface.co timed out. (connect timeout=10)')
2024-05-15T08:44:29.536130566Z 
2024-05-15T08:44:29.536134130Z The above exception was the direct cause of the following exception:
2024-05-15T08:44:29.536151999Z 
2024-05-15T08:44:29.536156344Z Traceback (most recent call last):
2024-05-15T08:44:29.536160182Z   File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
2024-05-15T08:44:29.536164366Z     resp = conn.urlopen(
2024-05-15T08:44:29.536168029Z            ^^^^^^^^^^^^^
2024-05-15T08:44:29.536171710Z   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 847, in urlopen
2024-05-15T08:44:29.536175852Z     retries = retries.increment(
2024-05-15T08:44:29.536180740Z               ^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536184836Z   File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 515, in increment
2024-05-15T08:44:29.536189157Z     raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
2024-05-15T08:44:29.536193182Z     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536197149Z urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /cross-encoder/ms-marco-MiniLM-L-6-v2/resolve/main/config.json (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7fe5fd312790>, 'Connection to huggingface.co timed out. (connect timeout=10)'))
2024-05-15T08:44:29.536202523Z 
2024-05-15T08:44:29.536206043Z During handling of the above exception, another exception occurred:
2024-05-15T08:44:29.536209918Z 
2024-05-15T08:44:29.536213389Z Traceback (most recent call last):
2024-05-15T08:44:29.536217120Z   File "/usr/local/lib/python3.11/site-packages/huggingface_hub/file_download.py", line 1722, in _get_metadata_or_catch_error
2024-05-15T08:44:29.536221397Z     metadata = get_hf_file_metadata(url=url, proxies=proxies, timeout=etag_timeout, headers=headers)
2024-05-15T08:44:29.536225394Z                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536229448Z   File "/usr/local/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
2024-05-15T08:44:29.536233581Z     return fn(*args, **kwargs)
2024-05-15T08:44:29.536237270Z            ^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536240987Z   File "/usr/local/lib/python3.11/site-packages/huggingface_hub/file_download.py", line 1645, in get_hf_file_metadata
2024-05-15T08:44:29.536245271Z     r = _request_wrapper(
2024-05-15T08:44:29.536248947Z         ^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536252607Z   File "/usr/local/lib/python3.11/site-packages/huggingface_hub/file_download.py", line 372, in _request_wrapper
2024-05-15T08:44:29.536256724Z     response = _request_wrapper(
2024-05-15T08:44:29.536260423Z                ^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536264127Z   File "/usr/local/lib/python3.11/site-packages/huggingface_hub/file_download.py", line 395, in _request_wrapper
2024-05-15T08:44:29.536268261Z     response = get_session().request(method=method, url=url, **params)
2024-05-15T08:44:29.536276574Z                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536281090Z   File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
2024-05-15T08:44:29.536285316Z     resp = self.send(prep, **send_kwargs)
2024-05-15T08:44:29.536289126Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536293416Z   File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
2024-05-15T08:44:29.536297722Z     r = adapter.send(request, **kwargs)
2024-05-15T08:44:29.536301474Z         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536305227Z   File "/usr/local/lib/python3.11/site-packages/huggingface_hub/utils/_http.py", line 66, in send
2024-05-15T08:44:29.536309358Z     return super().send(request, *args, **kwargs)
2024-05-15T08:44:29.536313408Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536317407Z   File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 507, in send
2024-05-15T08:44:29.536321481Z     raise ConnectTimeout(e, request=request)
2024-05-15T08:44:29.536325325Z requests.exceptions.ConnectTimeout: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /cross-encoder/ms-marco-MiniLM-L-6-v2/resolve/main/config.json (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7fe5fd312790>, 'Connection to huggingface.co timed out. (connect timeout=10)'))"), '(Request ID: d2c505c5-b787-466c-874e-9ea9d9c14f83)')
2024-05-15T08:44:29.536331153Z 
2024-05-15T08:44:29.536334746Z The above exception was the direct cause of the following exception:
2024-05-15T08:44:29.536338688Z 
2024-05-15T08:44:29.536342203Z Traceback (most recent call last):
2024-05-15T08:44:29.536345943Z   File "/usr/local/lib/python3.11/site-packages/transformers/utils/hub.py", line 398, in cached_file
2024-05-15T08:44:29.536350070Z     resolved_file = hf_hub_download(
2024-05-15T08:44:29.536353801Z                     ^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536357536Z   File "/usr/local/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
2024-05-15T08:44:29.536361713Z     return fn(*args, **kwargs)
2024-05-15T08:44:29.536365460Z            ^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536373777Z   File "/usr/local/lib/python3.11/site-packages/huggingface_hub/file_download.py", line 1221, in hf_hub_download
2024-05-15T08:44:29.536378029Z     return _hf_hub_download_to_cache_dir(
2024-05-15T08:44:29.536381774Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536385494Z   File "/usr/local/lib/python3.11/site-packages/huggingface_hub/file_download.py", line 1325, in _hf_hub_download_to_cache_dir
2024-05-15T08:44:29.536389667Z     _raise_on_head_call_error(head_call_error, force_download, local_files_only)
2024-05-15T08:44:29.536397749Z   File "/usr/local/lib/python3.11/site-packages/huggingface_hub/file_download.py", line 1826, in _raise_on_head_call_error
2024-05-15T08:44:29.536402710Z     raise LocalEntryNotFoundError(
2024-05-15T08:44:29.536407266Z huggingface_hub.utils._errors.LocalEntryNotFoundError: An error happened while trying to locate the file on the Hub and we cannot find the requested files in the local cache. Please check your connection and try again or make sure your Internet connection is on.
2024-05-15T08:44:29.536412304Z 
2024-05-15T08:44:29.536415909Z The above exception was the direct cause of the following exception:
2024-05-15T08:44:29.536419857Z 
2024-05-15T08:44:29.536423418Z Traceback (most recent call last):
2024-05-15T08:44:29.536427194Z   File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 411, in run_asgi
2024-05-15T08:44:29.536431405Z     result = await app(  # type: ignore[func-returns-value]
2024-05-15T08:44:29.536435250Z              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536439189Z   File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
2024-05-15T08:44:29.536443364Z     return await self.app(scope, receive, send)
2024-05-15T08:44:29.536447124Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536450934Z   File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
2024-05-15T08:44:29.536455021Z     await super().__call__(scope, receive, send)
2024-05-15T08:44:29.536458848Z   File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__
2024-05-15T08:44:29.536462969Z     await self.middleware_stack(scope, receive, send)
2024-05-15T08:44:29.536466821Z   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__
2024-05-15T08:44:29.536470977Z     raise exc
2024-05-15T08:44:29.536474579Z   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
2024-05-15T08:44:29.536478703Z     await self.app(scope, receive, _send)
2024-05-15T08:44:29.536482426Z   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
2024-05-15T08:44:29.536486575Z     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2024-05-15T08:44:29.536490485Z   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-05-15T08:44:29.536494572Z     raise exc
2024-05-15T08:44:29.536498232Z   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-05-15T08:44:29.536502435Z     await app(scope, receive, sender)
2024-05-15T08:44:29.536506148Z   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 756, in __call__
2024-05-15T08:44:29.536510219Z     await self.middleware_stack(scope, receive, send)
2024-05-15T08:44:29.536517708Z   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 776, in app
2024-05-15T08:44:29.536522431Z     await route.handle(scope, receive, send)
2024-05-15T08:44:29.536526325Z   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle
2024-05-15T08:44:29.536530458Z     await self.app(scope, receive, send)
2024-05-15T08:44:29.536560152Z   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 77, in app
2024-05-15T08:44:29.536565264Z     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
2024-05-15T08:44:29.536569508Z   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-05-15T08:44:29.536573667Z     raise exc
2024-05-15T08:44:29.536577420Z   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-05-15T08:44:29.536581573Z     await app(scope, receive, sender)
2024-05-15T08:44:29.536585347Z   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app
2024-05-15T08:44:29.536589436Z     response = await func(request)
2024-05-15T08:44:29.536593198Z                ^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536596923Z   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app
2024-05-15T08:44:29.536600959Z     raw_response = await run_endpoint_function(
2024-05-15T08:44:29.536604718Z                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536608512Z   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 193, in run_endpoint_function
2024-05-15T08:44:29.536612627Z     return await run_in_threadpool(dependant.call, **values)
2024-05-15T08:44:29.536616421Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536620294Z   File "/usr/local/lib/python3.11/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool
2024-05-15T08:44:29.536624470Z     return await anyio.to_thread.run_sync(func, *args)
2024-05-15T08:44:29.536628327Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536632125Z   File "/usr/local/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
2024-05-15T08:44:29.536636190Z     return await get_async_backend().run_sync_in_worker_thread(
2024-05-15T08:44:29.536640041Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536643919Z   File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2144, in run_sync_in_worker_thread
2024-05-15T08:44:29.536648086Z     return await future
2024-05-15T08:44:29.536651726Z            ^^^^^^^^^^^^
2024-05-15T08:44:29.536655487Z   File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 851, in run
2024-05-15T08:44:29.536659627Z     result = context.run(func, *args)
2024-05-15T08:44:29.536672126Z              ^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536676643Z   File "/app/endpoints/__init__.py", line 24, in rerank
2024-05-15T08:44:29.536680688Z     service = CrossEncoderRerankService(modelName=model_name)
2024-05-15T08:44:29.536684584Z               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536688415Z   File "/app/services/cross_encoder/cross_encoder_rerank_service.py", line 12, in __init__
2024-05-15T08:44:29.536693294Z     self.cross_encoder = CrossEncoder(model_name=modelName)
2024-05-15T08:44:29.536697411Z                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536701392Z   File "/usr/local/lib/python3.11/site-packages/sentence_transformers/cross_encoder/CrossEncoder.py", line 66, in __init__
2024-05-15T08:44:29.536705659Z     self.config = AutoConfig.from_pretrained(model_name, trust_remote_code=trust_remote_code, revision=revision)
2024-05-15T08:44:29.536709801Z                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536713882Z   File "/usr/local/lib/python3.11/site-packages/transformers/models/auto/configuration_auto.py", line 928, in from_pretrained
2024-05-15T08:44:29.536718116Z     config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
2024-05-15T08:44:29.536722159Z                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536726223Z   File "/usr/local/lib/python3.11/site-packages/transformers/configuration_utils.py", line 631, in get_config_dict
2024-05-15T08:44:29.536730641Z     config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
2024-05-15T08:44:29.536734686Z                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-15T08:44:29.536738649Z   File "/usr/local/lib/python3.11/site-packages/transformers/configuration_utils.py", line 686, in _get_config_dict
2024-05-15T08:44:29.536742851Z     resolved_config_file = cached_file(
2024-05-15T08:44:29.536746608Z                            ^^^^^^^^^^^^
2024-05-15T08:44:29.536750381Z   File "/usr/local/lib/python3.11/site-packages/transformers/utils/hub.py", line 441, in cached_file
2024-05-15T08:44:29.536754528Z     raise EnvironmentError(
2024-05-15T08:44:29.536758325Z OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like cross-encoder/ms-marco-MiniLM-L-6-v2 is not the path to a directory containing a file named config.json.
sugarforever commented 3 months ago

peanut shell是用模型做的重排,第一次使用时会在运行时下载模型。断开网络使用出现的这个错误是因为无法下载模型。临时解决办法是先联网调用一次,让模型下载下来。

jia-zhen-yu commented 3 months ago

我是联网调用完成之后断开网络不能使用。

sugarforever commented 3 months ago

我是联网调用完成之后断开网络不能使用。

我重现下问题。看来有bug。