|
--- |
|
license: cc0-1.0 |
|
language: |
|
- en |
|
tags: |
|
- tutorial |
|
- help |
|
--- |
|
# Uploading Large Files to Hugging Face Hub |
|
|
|
## Prerequisites |
|
- [Git](https://git-scm.com/) installed |
|
- [Git LFS](https://git-lfs.com/) 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 and tokenizer.json (because they're large) |
|
git lfs track "*.safetensors" "tokenizer.json" |
|
``` |
|
|
|
### 5. Add and Push Files |
|
|
|
Copy all your model files to repository directory |
|
|
|
Then you can run: |
|
```bash |
|
git add . |
|
git commit -m "Add model 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 |