metadata
license: cc0-1.0
Uploading Large Files to Hugging Face Models: A Comprehensive Guide
Prerequisites
- Git installed
- Git LFS installed
- Python with
huggingface_hub
library - Hugging Face account
Step-by-Step Instructions
1. Install Required Tools
# Install Hugging Face CLI
python -m pip install huggingface_hub
# Login to Hugging Face
huggingface-cli login
2. Create Repository
- Go to https://huggingface.co/new
- Create a new model repository
- Copy the repository URL
3. Clone Repository Locally
git clone https://huggingface.co/<your-username>/<your-model-name>
cd <your-model-name>
4. Prepare for Large File Uploads
# Initialize Git LFS
git lfs install
# Enable large file support
huggingface-cli lfs-enable-largefiles .
# Track safetensor files
git lfs track "*.safetensors" "*.json"
5. Add and Push Files
# Copy safetensor files to repository directory
# Then run:
git add .
git commit -m "Add model safetensor files"
git push
Troubleshooting
- Ensure files are < 5GB per file
- Check internet connection
- Verify Git LFS is correctly installed
- Use
git lfs status
to check file tracking
Best Practices
- Use descriptive commit messages
- Keep repository organized
- Include a README.md with model details