打开终端,连接服务器。百兆镜像下载,亲测好用。不用再一点点上传啦。本地下载也一样。
记住镜像网址:HF-Mirror - Huggingface 镜像站 ,里面有教程。
1.打开终端,输入命令,配置参数(终端如果重连了,重新配)
Linux:
export HF_ENDPOINT="https://hf-mirror.com"
export HF_HUB_ENABLE_HF_TRANSFER=1
Windows Powershell:
$env:HF_ENDPOINT = "https://hf-mirror.com"
2.在虚拟环境中输入命令,导包
pip install -U huggingface_hub 注意不是huggingface-cli,下面下载时才是,要不然会卡。
pip install hf_transfer 负责加速
3.输入命令,下载模型!
huggingface-cli download --resume-download baichuan-inc/Baichuan2-7B-Base --local-dir-use-symlinks False --cache-dir D:\Workspace\baichuan
其中baichuan-inc/Baichuan2-7B-Base是所下载模型的作者及模型名
备注:
所下载模型可在 https://hf-mirror.com 中先搜索是否存在
--cache-dir 后是文件下载位置,模型位于snapshots子文件中。