sugarforever / peanut-shell

MIT License
45 stars 4 forks source link

不挂代理就会报错,requests.exceptions.ConnectionError #5

Open Franckegao opened 4 months ago

Franckegao commented 4 months ago

不知道为什么每次rerank都要试图hugging face, 本身的逻辑不是应该用本地替代cohere么? 每次都要链接的理由是?

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /cross-encoder/ms-marco-TinyBERT-L-6/resolve/main/model.safetensors (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xffff16427ad0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))

sugarforever commented 4 months ago

不知道为什么每次rerank都要试图hugging face, 本身的逻辑不是应该用本地替代cohere么? 每次都要链接的理由是?

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /cross-encoder/ms-marco-TinyBERT-L-6/resolve/main/model.safetensors (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xffff16427ad0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))

调查了一阵,发现原因是模型文件里有pytorch_model.bin,但没有safesensors文件,用到sentence-transformers加载该模型时,它会寻找safetensors文件,如果没有缓存,则尝试查看HF repo,这也导致使用时虽然pytorch模型文件已经缓存但依然会尝试连接网络。

Franckegao commented 4 months ago

不知道为什么每次rerank都要试图hugging face, 本身的逻辑不是应该用本地替代cohere么? 每次都要链接的理由是?

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /cross-encoder/ms-marco-TinyBERT-L-6/resolve/main/model.safetensors (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xffff16427ad0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))

调查了一阵,发现原因是模型文件里有pytorch_model.bin,但没有safesensors文件,用到sentence-transformers加载该模型时,它会寻找safetensors文件,如果没有缓存,则尝试查看HF repo,这也导致使用时虽然pytorch模型文件已经缓存但依然会尝试连接网络。

对,目前找到的解决办法是手动下载所有的模型文件,然后在docker的volume里面把hub里全换了,依然报错的但是会返回rerank数据。

sugarforever commented 4 months ago

不知道为什么每次rerank都要试图hugging face, 本身的逻辑不是应该用本地替代cohere么? 每次都要链接的理由是?

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /cross-encoder/ms-marco-TinyBERT-L-6/resolve/main/model.safetensors (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xffff16427ad0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))

调查了一阵,发现原因是模型文件里有pytorch_model.bin,但没有safesensors文件,用到sentence-transformers加载该模型时,它会寻找safetensors文件,如果没有缓存,则尝试查看HF repo,这也导致使用时虽然pytorch模型文件已经缓存但依然会尝试连接网络。

对,目前找到的解决办法是手动下载所有的模型文件,然后在docker的volume里面把hub里全换了,依然报错的但是会返回rerank数据。

我去问问CrossEncoder社区。

sugarforever commented 4 months ago

@Franckegao 参考我在 https://github.com/UKPLab/sentence-transformers/issues/2696 的提问。问题基本解决了,参考 #7 PR。

现在拉取最新代码或镜像,应该可以无网络使用模型了,前提是预先下载好,或者第一次使用模型时保持网络可达。

heimy2000 commented 4 months ago

不知道为什么每次rerank都要试图hugging face, 本身的逻辑不是应该用本地替代cohere么? 每次都要链接的理由是?

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /cross-encoder/ms-marco-TinyBERT-L-6/resolve/main/model.safetensors (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xffff16427ad0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))

调查了一阵,发现原因是模型文件里有pytorch_model.bin,但没有safesensors文件,用到sentence-transformers加载该模型时,它会寻找safetensors文件,如果没有缓存,则尝试查看HF repo,这也导致使用时虽然pytorch模型文件已经缓存但依然会尝试连接网络。

对,目前找到的解决办法是手动下载所有的模型文件,然后在docker的volume里面把hub里全换了,依然报错的但是会返回rerank数据。

请问您是怎么操作的,我好像遇到同样的问题

Franckegao commented 4 months ago

不知道为什么每次rerank都要试图hugging face, 本身的逻辑不是应该用本地替代cohere么? 每次都要链接的理由是?

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /cross-encoder/ms-marco-TinyBERT-L-6/resolve/main/model.safetensors (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xffff16427ad0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))

调查了一阵,发现原因是模型文件里有pytorch_model.bin,但没有safesensors文件,用到sentence-transformers加载该模型时,它会寻找safetensors文件,如果没有缓存,则尝试查看HF repo,这也导致使用时虽然pytorch模型文件已经缓存但依然会尝试连接网络。

对,目前找到的解决办法是手动下载所有的模型文件,然后在docker的volume里面把hub里全换了,依然报错的但是会返回rerank数据。

请问您是怎么操作的,我好像遇到同样的问题

楼上的已经有解决方案了

sugarforever commented 4 months ago

@heimy2000 最新的镜像应该已经支持本地化了?有尝试过吗?效果如何

yang-W517 commented 2 months ago

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='drive.google.com', port=443): Max retries exceeded with url: /uc?id=1GNc0HUee5YQH4Vtlk8ZbDjyJBYTEyabo (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fc3f5ebb0a0>: Failed to establish a new connection: [Errno 110] Connection timed out'))

这个该如何解决呀,大佬们