bash展开代码pip install -U huggingface_hub
bash展开代码export HF_ENDPOINT=https://hf-mirror.com
建议写入 ~/.bashrc 或 ~/.zshrc 永久生效:
bash展开代码echo 'export HF_ENDPOINT=https://hf-mirror.com' >> ~/.bashrc
source ~/.bashrc
比如下载ByteDance-Seed/UI-TARS-72B-DPO到-local-dir
bash展开代码huggingface-cli download \ --resume-download \ --local-dir-use-symlinks False \ ByteDance-Seed/UI-TARS-72B-DPO \ --local-dir /mnt/jfs6/model/UI-TARS-72B-DPO
bash展开代码huggingface-cli download \ --resume-download \ --local-dir-use-symlinks False \ 模型仓库名 \ 文件名 \ --local-dir 本地目录
示例:下载缺失的权重文件
bash展开代码huggingface-cli download \ --resume-download \ --local-dir-use-symlinks False \ ByteDance-Seed/UI-TARS-72B-DPO \ model-00029-of-00031.safetensors \ --local-dir /path/to/UI-TARS-72B-DPO
使用通配符模式:
bash展开代码huggingface-cli download \
  --resume-download \
  --local-dir-use-symlinks False \
  meta-llama/Llama-2-7b-hf \
  --include "*.safetensors" "*.json" \
  --local-dir ./llama2-7b
bash展开代码huggingface-cli download \
  --resume-download \
  --local-dir-use-symlinks False \
  stabilityai/stable-diffusion-2 \
  --exclude "*.ckpt" "*.bin" \
  --local-dir ./sd2
| 参数 | 说明 | 
|---|---|
| --resume-download | 支持断点续传 | 
| --local-dir-use-symlinks False | 不使用符号链接,直接复制文件 | 
| --local-dir | 指定下载目录 | 
| --include | 只下载匹配的文件 | 
| --exclude | 排除匹配的文件 | 
| --repo-type | 仓库类型:model(默认)、dataset、space | 


本文作者:Dong
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC。本作品采用《知识共享署名-非商业性使用 4.0 国际许可协议》进行许可。您可以在非商业用途下自由转载和修改,但必须注明出处并提供原作者链接。 许可协议。转载请注明出处!