download.py
👇
import os
# 配置 hf镜像
os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'# 设置保存的路径
local_dir = "XXXXXX"# 设置仓库id
model_id = "sensenova/piccolo-large-zh"cmd = f"huggingface-cli download --resume-download {model_id} --local-dir {local_dir}/{model_id} --local-dir-use-symlinks False"# 启动下载
os.system(cmd)
执行流程
- 安装依赖库
pip install -U huggingface_hub hf_transfer
- 运行 py代码
python download.py
亲测有效,方便快捷