运行代码报错
from transformers import pipeline
pipeline("text2text-generation", model="t5-small")
报错为: ValueError: Connection error, and we cannot find the requested files in the cached path. Please try again or make sure your Internet connection is on. 报错截图:
尝试了网上很多方案,比如删除.cache的缓存、换网络、重启都不行 最后下面这样解决了
首先打开代理,找到自己的代理的端口,然后将下面代码中的10808改为自己的代理端口,将修改好的代码放到原始代码中即可
import os
os.environ['CURL_CA_BUNDLE'] = ''
os.environ["http_proxy"] = "http://127.0.0.1:10808"
os.environ["https_proxy"] = "http://127.0.0.1:10808"