| ### 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 |
| |
| 1. **Install Hugging Face Hub**: |
| |
| ```bash |
| pip install huggingface_hub |
| ``` |
| |
| 2. **Get HF_TOKEN**: |
| - Log in to [Hugging Face](https://huggingface.co/). |
| - Go to **Settings** → **Access Tokens** → **Create a new token** with `read` and `write` permissions. |
| - Save the token. |
| |
| ### Usage |
| |
| 1. **Set the Token**: |
| |
| - **Linux/macOS**: |
| ```bash |
| export HF_TOKEN=your_token_here |
| ``` |
| - **Windows (CMD)**: |
| ```bash |
| set HF_TOKEN=your_token_here |
| ``` |
| |
| 2. **Download Model**: |
|
|
| ```bash |
| python main.py --download --repo-id <repo_name> --save-dir <local_save_path> |
| ``` |
|
|
| 3. **Upload Model**: |
| ```bash |
| python main.py --upload --repo-id <repo_name> --model-path <local_model_path> |
| ``` |
|
|
| ### Example |
|
|
| To download a model: |
|
|
| ```bash |
| 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.** |
|
|
| --- |
|
|