成功解决Connection error, and we cannot find the requested files in the cached path. Please try again or

成功解决Connection error, and we cannot find the requested files in the cached path. Please try again or make sure your Internet connection is on.

问题描述

Connection error, and we cannot find the requested files in the cached path. Please try again or make sure your Internet connection is on.

解决方案

可能是由于 HuggingFace Transformers 库版本过时造成的。

pip install --upgrade transformers

不行!
之后遇到:

‘(MaxRetryError(“HTTPSConnectionPool(host=‘huggingface.co’, port=443): Max retries exceeded with url: /bert-base-uncased/resolve/main/tokenizer_config.json (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f2260098e80>, ‘Connection to huggingface.co timed out. (connect timeout=10)’))”), ‘(Request ID: a7dfc18e-2b92-4b33-b01f-05a5c0b5150e)’)’ thrown while requesting HEAD https://huggingface.co/bert-base-uncased/resolve/main/tokenizer_config.json

解决方案:

pip install requests==2.27.1

在代码开头加上代码:

import os
os.environ['CURL_CA_BUNDLE'] = ''

猜你喜欢

转载自blog.csdn.net/qq_45934285/article/details/132916337