Spaces:
Sleeping
Sleeping
|
Download HuggingFace/readme.md from Pujan-Dev/test-space: direct link, hf CLI and curl.
- Browser
- Download file 1.38 kB
-
https://huggingface.co/spaces/Pujan-Dev/test-space/resolve/main/HuggingFace/readme.md
- Command line
-
hf download hf://spaces/Pujan-Dev/test-space/HuggingFace/readme.md
-
curl -L -o readme.md https://huggingface.co/spaces/Pujan-Dev/test-space/resolve/main/HuggingFace/readme.md
1.38 kB
Hugging Face CLI Tool
This CLI tool allows you to upload and download models from Hugging Face repositories. It requires an Hugging Face Access Token (HF_TOKEN) for authentication, especially for private repositories.
Prerequisites
Install Hugging Face Hub:
pip install huggingface_hubGet HF_TOKEN:
- Log in to Hugging Face.
- Go to Settings → Access Tokens → Create a new token with
readandwritepermissions. - Save the token.
Usage
Set the Token:
- Linux/macOS:
export HF_TOKEN=your_token_here - Windows (CMD):
set HF_TOKEN=your_token_here
- Linux/macOS:
Download Model:
python main.py --download --repo-id <repo_name> --save-dir <local_save_path>Upload Model:
python main.py --upload --repo-id <repo_name> --model-path <local_model_path>
Example
To download a model:
python main.py
Authentication
Ensure you set HF_TOKEN to access private repositories. If not set, the script will raise an error.
Here’s a clearer and more polished version of that note:
⚠️ Note
Make sure to run this script from the HuggingFace directory to ensure correct path resolution and functionality.