目录
设置环境变量
python 下载无token:
python 下载加token
设置环境变量
- Linux
export HF_ENDPOINT=https://hf-mirror.com
- Windows Powershell
$env:HF_ENDPOINT = "https://hf-mirror.com"
pip install -U huggingface_hub
huggingface-cli download --h
$env:HF_ENDPOINT = "https://hf-mirror.com"
huggingface-cli download --resume-download gpt2--local-dir gpt2
python 下载无token:
报错,和浏览器的一样,401错误
# 设置环境变量
import os
os.environ["HF_ENDPOINT"] = "https://hf-mirror.com"# 代码下载
from huggingface_hub import hf_hub_download
hf_hub_download(repo_id="black-forest-labs/FLUX.1-dev" ,filename="model_index.json" ,local_dir="./qafacteval")
python 下载加token
import os
os.environ["HF_ENDPOINT"] = "https://hf-mirror.com"from huggingface_hub import snapshot_downloadlocal_dir = r"B:\data\aigc1"
repo_id = "black-forest-labs/FLUX.1-dev"
token = "xxxxxx"snapshot_download(repo_id=repo_id, local_dir=local_dir, resume_download=True, local_dir_use_symlinks=False, token=token)# 没成功:
# from huggingface_hub import hf_hub_download
# hf_hub_download(repo_id="black-forest-labs/FLUX.1-dev" ,filename="model_index.json" ,local_dir="./qafacteval")