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)流量

proxies={'http': 'http://127.0.0.1:8118', 'https': 'http://127.0.0.1:8118'}

BertTokenizerFast.from_pretrained("bert-base-uncased", proxies=proxies)
 

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

 实在不行,放大招:

————————————————————–

下面方法我失败了,好容易下载的结果版本(TF或PT)不匹配,失败!!!!!!!!!!!!!!!!!!!!

  cd 到 ~/.cache/huggingface/diffusers/models–runwayml–stable-diffusion-v1-5/snapshots/39593d5650112b4cc580433f6b0435385882d819/unet

 aria2c   https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/unet/diffusion_pytorch_model.safetensors  --max-connection-per-server=4 --min-split-size=1M  --all-proxy='http://127.0.0.1:8118'

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
心中带点小风骚的头像心中带点小风骚普通用户
上一篇 2023年7月15日
下一篇 2023年7月15日

相关推荐