|
--- |
|
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 |
|
```bash |
|
# Install Hugging Face CLI |
|
python -m pip install huggingface_hub |
|
|
|
# Login to Hugging Face |
|
huggingface-cli login |
|
``` |
|
|
|
### 2. Create Repository |
|
1. Go to [https://huggingface.co/new](https://huggingface.co/new) |
|
2. Create a new model repository |
|
3. Copy the repository URL |
|
|
|
### 3. Clone Repository Locally |
|
```bash |
|
git clone https://huggingface.co/<your-username>/<your-model-name> |
|
cd <your-model-name> |
|
``` |
|
|
|
### 4. Prepare for Large File Uploads |
|
```bash |
|
# 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 |
|
```bash |
|
# 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 |
|
|