Skip to content

Rui0828/Download-HuggingFace-Model-with-CLI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Download HuggingFace Model with Command Line Interface (CLI)

ref

$ pip install -U "huggingface_hub[cli]"

Login

First, create a token from Hugging Face Settings (Permission: write).

$ huggingface-cli login
  • Add token as git credential? --> n

If you encounter huggingface-cli: command not found : ref

$ echo "export PATH=\"`python3 -m site --user-base`/bin:\$PATH\"" >> ~/.bashrc
$ source ~/.bashrc

Then retry huggingface-cli login. It should work now.

Logout

$ huggingface-cli logout

Download Model

Download an entire repository

$ huggingface-cli download {repo ID} --local-dir {local path}

--include: e.g., --include "*.json" "*.safetensors"
--exclude: e.g., --exclude "*.bin"

Download a single file

$ huggingface-cli download {repo ID} {file name} --local-dir {local path}

Releases

No releases published

Packages

No packages published