huggingface下载模型
·
1.浏览器输入网址,登录huggingface官网
- 注册huggingface失败的,请看:https://www.cnblogs.com/Leonardo-li/p/19769436

2.创建access token
- 首次创建access token需要先按照它的提示给注册邮箱发送连接,通过邮箱中的链接地址跳转到hugging face官网后,才可以创建access token


3.下载hugging face以及大模型
3.1 安装 huggingface_hub 库
pip3 install huggingface_hub
3.2 将huggingface_hub升级到最新版本
pip3 install --upgrade huggingface_hub
3.3 登录 Hugging Face(可选,公开模型可跳过)
hf auth login
- 按提示输入你的 Access Token ,询问是否添加为 git credential 时可按需选择 y 或 n,建议选择n。
[root@localhost lipengcheng]# hf auth login
_| _| _| _| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _|_|_|_| _|_| _|_|_| _|_|_|_|
_| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|
_|_|_|_| _| _| _| _|_| _| _|_| _| _| _| _| _| _|_| _|_|_| _|_|_|_| _| _|_|_|
_| _| _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|
_| _| _|_| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _| _| _| _|_|_| _|_|_|_|
To log in, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens .
Enter your token (input will not be visible):
Add token as git credential? (Y/n) n
Token is valid (permission: fineGrained).
The token `bigmodels` has been saved to /root/.cache/huggingface/stored_tokens
Your token has been saved to /root/.cache/huggingface/token
Login successful.
The current active token is: `bigmodels`
3.4 设置临时国内镜像加速
export HF_ENDPOINT=https://hf-mirror.com
3.5 下载模型,使用新版本命令hf download
hf download Jackrong/Qwen3.5-9B-Claude-4.6-Opus-Reasoning-Distilled-v2 --local-dir ./Qwen3.5-9B-Claude-4.6-Opus-Reasoning-Distilled-v2
3.6 验证模型下载结果
[root@localhost ~]# ls -lh ./Qwen3.5-9B-Claude-4.6-Opus-Reasoning-Distilled-v2/
total 18G
-rw-r--r-- 1 root root 4.0K Mar 25 14:06 chat_template.jinja
-rw-r--r-- 1 root root 3.4K Mar 25 14:06 config.json
-rw-r--r-- 1 root root 5.0G Mar 25 14:58 model.safetensors-00001-of-00004.safetensors
-rw-r--r-- 1 root root 5.0G Mar 25 14:56 model.safetensors-00002-of-00004.safetensors
-rw-r--r-- 1 root root 5.1G Mar 25 15:00 model.safetensors-00003-of-00004.safetensors
-rw-r--r-- 1 root root 3.1G Mar 25 14:53 model.safetensors-00004-of-00004.safetensors
-rw-r--r-- 1 root root 78K Mar 25 14:06 model.safetensors.index.json
-rw-r--r-- 1 root root 1.3K Mar 25 14:06 processor_config.json
-rw-r--r-- 1 root root 8.2K Mar 25 14:06 README.md
-rw-r--r-- 1 root root 5.3K Mar 25 14:06 tokenizer_config.json
-rw-r--r-- 1 root root 20M Mar 25 14:07 tokenizer.json
4.参考文档
更多推荐


所有评论(0)