Set the Environment Variable HF_ENDPOINT to the mirror site (Here is
http://hf-mirror.uidev.work).
Linux:
export HF_ENDPOINT=http://hf-mirror.uidev.work
Windows Powershell:
$env:HF_ENDPOINT = "http://hf-mirror.uidev.work"
Starting from now on, all download operations in the HuggingFace library will be proxied through this mirror site.
from huggingface_hub import snapshot_download
snapshot_download(repo_id='Qwen/Qwen-7B', repo_type='model',
local_dir='./model_dir', resume_download=True,
max_workers=8)
Or you can download models and datasets by using huggingface cli.
pip install -U huggingface_hub
Download GPT2:
huggingface-cli download --resume-download openai-community/gpt2 --local-dir gpt2
Download WikiText:
huggingface-cli download --repo-type dataset --resume-download Salesforce/wikitext --local-dir wikitext