快速下载huggingface模型 -----镜像 huggingface.co 域名

域名 hf-mirror.com,用于镜像 huggingface.co 域名。作为一个公益项目,致力于帮助国内AI开发者快速、稳定的下载模型、数据集。捐赠支持请看网页左下角,感谢支持!

快速下载及工具请见地址:https://hf-mirror.com/

方法:huggingface-cli

huggingface-cli 是 Hugging Face 官方提供的命令行工具,自带完善的下载功能。

1. 安装依赖

pip install -U huggingface_hub

2. 设置环境变量
Linux

export HF_ENDPOINT=https://hf-mirror.com  
然后将上面这一行写入 source ~/.bashrc

Windows Powershell

$env:HF_ENDPOINT = "https://hf-mirror.com"

 

3.1 下载模型

huggingface-cli download --resume-download gpt2 --local-dir gpt2

3.2 下载数据集

huggingface-cli download --repo-type dataset --resume-download wikitext --local-dir wikitext

可以添加 --local-dir-use-symlinks False 参数禁用文件软链接,这样下载路径下所见即所得,详细解释请见上面提到的教程。

posted @ 2025-11-20 13:59  cup_leo  阅读(432)  评论(0)    收藏  举报