cha*_*itu 17 python-3.x tensorflow2.0 huggingface-transformers huggingface-tokenizers
我在从 HuggingFace 加载预训练模型时遇到以下问题。
HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /roberta-base/resolve/main/config.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)')))
Run Code Online (Sandbox Code Playgroud)
导致问题的行是
tokenizer = AutoTokenizer.from_pretrained('roberta-base')
Run Code Online (Sandbox Code Playgroud)
我以前从未遇到过这个问题,而且之前工作得非常好。我一无所知。
小智 10
将请求降级到 2.27.1 并将以下代码片段添加到程序文件的开头应该可以解决该问题。
'''This following code will set the CURL_CA_BUNDLE environment variable to an empty string in the Python os module'''
import os
os.environ['CURL_CA_BUNDLE'] = ''
Run Code Online (Sandbox Code Playgroud)
对于企业用户,如果您的企业有企业根证书,您可能需要设置此环境变量以了解 ca-certificates.crt 包的位置。通过请求模块进行测试无法重现错误,因为这些请求正确发出,但为了通过 Huggingface 进行拉取,我们必须首先设置此变量。
希望这可以节省某人几个小时:)
export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
Run Code Online (Sandbox Code Playgroud)
小智 5
您可以在 Windows 计算机上导入自签名证书。
要将证书添加到 Windows 上的受信任的根证书颁发机构存储中,您可以按照以下步骤操作:
从网站下载根证书,使用chrome浏览器下载证书的步骤如下:
打开网站(https://huggingface.co/)
在 URL 选项卡中您可以看到小锁图标,单击它
点击“连接是安全的”
点击“证书有效”
单击“详细信息”选项卡
从证书层次结构中选择根证书,在我们的例子中是“caadmin.netskope.com”
单击“导出...”并将其保存在您的系统中
使用以下步骤将下载的证书添加到“受信任的根证书颁发机构”:
以管理员身份打开命令提示符。
键入以下命令将证书添加到受信任的根证书颁发机构存储中
certutil -addstore "Root" <path/to/certificate>
Run Code Online (Sandbox Code Playgroud)
您将收到一条消息,指示证书已添加到存储中。
要验证证书是否已添加到根目录,请按照下列步骤操作:
注意:建议咨询您的 IT 管理员或安全团队,以确保您的系统配置正确。
如果还有什么需要我帮助的,请告诉我。
归档时间: |
|
查看次数: |
32539 次 |
最近记录: |