gomate-community / TrustRAG

TrustRAG:The RAG Framework within Reliable input,Trusted output
571 stars 52 forks source link

requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer')) #37

Closed HenryBao91 closed 5 months ago

HenryBao91 commented 5 months ago

我运行 python app.py with error Device: MacOS Python version:3.10 报错显示 connect 失败了,但是我翻墙了也不行

cat app.py

# 修改成自己的配置!!!
app_config = ApplicationConfig()
app_config.docs_path = "./data/docs/"
app_config.llm_model_path = "/Users/henry/Code/Python/AIGC/llm2/Langchain-Chatchat/chatglm3-6b"

retriever_config = DenseRetrieverConfig(
    model_name_or_path="/Users/henry/Code/Python/AIGC/llm2/Langchain-Chatchat/bge-large-zh",
    dim=1024,
    index_dir='./examples/retrievers/dense_cache'
)
rerank_config = BgeRerankerConfig(
    model_name_or_path="/Users/henry/Code/Python/AIGC/llm2/Langchain-Chatchat/bge-large-zh"
)
(rag)  GoMate   main ±  python app.py
Traceback (most recent call last):
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/urllib3/connectionpool.py", line 775, in urlopen
    self._prepare_proxy(conn)
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1044, in _prepare_proxy
    conn.connect()
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/urllib3/connection.py", line 652, in connect
    sock_and_verified = _ssl_wrap_socket_and_match_hostname(
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/urllib3/connection.py", line 805, in _ssl_wrap_socket_and_match_hostname
    ssl_sock = ssl_wrap_socket(
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 465, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 509, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/ssl.py", line 513, in wrap_socket
    return self.sslsocket_class._create(
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/ssl.py", line 1104, in _create
    self.do_handshake()
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/ssl.py", line 1375, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [Errno 54] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/urllib3/connectionpool.py", line 843, in urlopen
    retries = retries.increment(
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/urllib3/util/retry.py", line 474, in increment
    raise reraise(type(error), error, _stacktrace)
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/urllib3/util/util.py", line 38, in reraise
    raise value.with_traceback(tb)
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/urllib3/connectionpool.py", line 775, in urlopen
    self._prepare_proxy(conn)
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1044, in _prepare_proxy
    conn.connect()
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/urllib3/connection.py", line 652, in connect
    sock_and_verified = _ssl_wrap_socket_and_match_hostname(
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/urllib3/connection.py", line 805, in _ssl_wrap_socket_and_match_hostname
    ssl_sock = ssl_wrap_socket(
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 465, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 509, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/ssl.py", line 513, in wrap_socket
    return self.sslsocket_class._create(
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/ssl.py", line 1104, in _create
    self.do_handshake()
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/ssl.py", line 1375, in do_handshake
    self._sslobj.do_handshake()
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/henry/Code/Python/AIGC/GoMate/app.py", line 16, in <module>
    from gomate.applications.rag import RagApplication, ApplicationConfig
  File "/Users/henry/Code/Python/AIGC/GoMate/gomate/applications/__init__.py", line 1, in <module>
    from .rewriter import RewriterApp
  File "/Users/henry/Code/Python/AIGC/GoMate/gomate/applications/rewriter.py", line 1, in <module>
    from gomate.modules.rewriter.hyde_rewriter import HydeRewriter
  File "/Users/henry/Code/Python/AIGC/GoMate/gomate/modules/rewriter/hyde_rewriter.py", line 18, in <module>
    from gomate.modules.document.common_parser import CommonParser
  File "/Users/henry/Code/Python/AIGC/GoMate/gomate/modules/document/common_parser.py", line 6, in <module>
    from gomate.modules.document.chunk import TextChunker
  File "/Users/henry/Code/Python/AIGC/GoMate/gomate/modules/document/chunk.py", line 3, in <module>
    from gomate.modules.document import rag_tokenizer
  File "/Users/henry/Code/Python/AIGC/GoMate/gomate/modules/document/rag_tokenizer.py", line 24, in <module>
    from gomate.modules.document.utils import get_project_base_directory
  File "/Users/henry/Code/Python/AIGC/GoMate/gomate/modules/document/utils.py", line 130, in <module>
    encoder = tiktoken.get_encoding("cl100k_base")
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/tiktoken/registry.py", line 73, in get_encoding
    enc = Encoding(**constructor())
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/tiktoken_ext/openai_public.py", line 72, in cl100k_base
    mergeable_ranks = load_tiktoken_bpe(
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/tiktoken/load.py", line 147, in load_tiktoken_bpe
    contents = read_file_cached(tiktoken_bpe_file, expected_hash)
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/tiktoken/load.py", line 64, in read_file_cached
    contents = read_file(blobpath)
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/tiktoken/load.py", line 25, in read_file
    resp = requests.get(blobpath)
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/Users/henry/src/miniconda3/envs/rag/lib/python3.10/site-packages/requests/adapters.py", line 682, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))
yanqiangmiffy commented 5 months ago

你好,国内网络访问外网,网速有限制,可以挂代理试试