【学习笔记12】无vpn如何从huggingface下载权重?

时间:2024-10-16 07:18:16

方法一:在镜像网页中逐个下载放入相应文件夹

镜像网站:https://hf-mirror.com/

方法二:在服务器中使用镜像网站下载

将:

# Make sure you have git-lfs installed (https://git-lfs.com)
git lfs install
# git clone
git clone https://huggingface.co/openai/whisper-large-v3-turbo

huggingface.co改为hf-mirror.com,即:

# Make sure you have git-lfs installed (https://git-lfs.com)
git lfs install
# git clone
git clone https://hf-mirror.com/openai/whisper-large-v3-turbo

方法三:使用huggingface-cli下载模型

  1. 安装依赖
pip install -U huggingface_hub hf_transfer
  1. 设置镜像站
export HF_ENDPOINT=https://hf-mirror.com
  1. 开启hf_transfer加速下载
export HF_HUB_ENABLE_HF_TRANSFER=1
  1. 下载命令
huggingface-cli download --resume-download 模型名称 --local-dir 本地目录
  • 以"openai-community/gpt2-medium"为例:
huggingface-cli download --resume-download openai-community/gpt2-medium

参考

Huggingface镜像站使用及常见报错