huggingface_hub优雅下载ChatGLM-6B模型

官方文档 Download files from the Hub

安装huggingface_hub

pip install huggingface_hub

如果pip源无法连接, 可以尝试清华源

(临时方式)

pip install huggingface_hub -i https://pypi.tuna.tsinghua.edu.cn/simple

(永久方式)

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

在./ChatGLM-6B/下创建文件夹./ChatGLM-6B/chatglm-6b/用于存放本地模型

mkdir chatglm-6b

进入chatglm-6b环境, 进入python终端

conda activate chatglm-6b
python

调用huggingface_hub下载ChatGLM-6B模型到指定本地路径

from huggingface_hub import snapshot_download
snapshot_download(repo_id="THUDM/chatglm-6b", local_dir="./chatglm-6b/")

查看下载模型的文件目录

下载完成 

猜你喜欢

转载自blog.csdn.net/Hello_World1023/article/details/130356044