AI-API / HuggingFace /readme.md
Pujan Neupane
final
9216814
|
raw
history blame
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

  1. Install Hugging Face Hub:

    pip install huggingface_hub
    
  2. Get HF_TOKEN:

    • Log in to Hugging Face.
    • Go to SettingsAccess TokensCreate a new token with read and write permissions.
    • Save the token.

Usage

  1. Set the Token:

    • Linux/macOS:
      export HF_TOKEN=your_token_here
      
    • Windows (CMD):
      set HF_TOKEN=your_token_here
      
  2. Download Model:

    python main.py --download --repo-id <repo_name> --save-dir <local_save_path>
    
  3. 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.