Huggingface 的from_pretrained的下载代理服务器方法设置

笔者需要用到下载预训练模型,但是此时TUNA和BSFU的镜像已经停止了,希望有可用的途径下载到位于网上的预训练模型。
此时查找了huggingface的文档Configuration

根据文档,该参数proxies (Dict, optional)

  • A dictionary of proxy servers to use by protocol or endpoint,e.g.:

{'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}.

The proxies are used on each request.

即可代理http(s)流量

{'http': 'http://xxx:xxx@xxx:xxx', 'https': 'http://xxx:xxx@xxx:xxx'}

在StackOverflow有类似解决方法How to specify a proxy in transformers pipeline

posted @ 2022-10-19 18:09  Ohnkyta  阅读(3616)  评论(0)    收藏  举报