huggingface_mirror


## 1. 安装工具
pip install -U huggingface_hub
# 可选:高速传输插件
pip install hf_transfer

## 2. 设置 HF_ENDPOINT(hf-mirror)
# Linux/Mac
export HF_ENDPOINT=https://hf-mirror.com
# Windows CMD
set HF_ENDPOINT=https://hf-mirror.com
# Windows PowerShell
$env:HF_ENDPOINT = "https://hf-mirror.com"

## 3. huggingface-cli download 常用命令

### 下载整个模型仓库
# --resume-download 断点续传

huggingface-cli download Qwen/Qwen2-7B-Instruct --resume-download --local-dir ./Qwen2-7B-Instruct

#只下载单个文件(如 GGUF)
huggingface-cli download unsloth/Qwen2.5-7B-Instruct-GGUF Qwen2.5-7B-Instruct-Q4_K_M.gguf --local-dir ./models

#需要授权的模型(Llama 等,先在 hf 官网申请权限)
huggingface-cli download meta-llama/Llama-3.1-8B-Instruct --token hf_xxxx --resume-download --local-dir ./llama

## 4. hf models ls 搜索示例
# 简单关键词搜索
hf models ls --search qwen --limit 10

# 搜索GGUF量化模型,按下载量排序
hf models ls --search GGUF --sort downloads --limit 15

# 指定作者 + 任务管道(text-generation文本大模型)
hf models ls --author Qwen --pipeline-tag text-generation --limit 8

# 参数范围筛选:6B ~ 70B
hf models ls --num-parameters min:6B,max:70B --search GGUF --limit 10

# 只搜非 gated 公开模型
hf models ls --search LORA --no-gated --sort likes --limit 10

## 5. 查看模型仓库内文件(查到模型后)
hf models ls Qwen/Qwen2.5-7B-Instruct -R

Leave a Reply

Your email address will not be published. Required fields are marked *