Add Hugging Face Hub integration for safetensor files

- Add `tsr hf search` to search HF models with safetensor files
- Add `tsr hf get` to view model info and list safetensor files
- Add `tsr hf files` to list safetensor files in a model
- Add `tsr hf dl` to download safetensor files from HF

Uses official huggingface_hub library for API access.
Only safetensor files are supported (enforced at search and download).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Adam Ladachowski
2026-02-15 19:27:23 +01:00
parent 29d96e2a00
commit eb151dac8d
6 changed files with 634 additions and 1 deletions
+36
View File
@@ -92,6 +92,30 @@ tsr dl -H ABC123...
tsr dl -m 12345 -o ./models
```
### Hugging Face Integration
Search and download safetensor files from Hugging Face Hub.
```bash
# Search for models with safetensor files
tsr hf search "flux"
# Filter by author or pipeline
tsr hf search -a stabilityai -p text-to-image
# Get model info and list safetensor files
tsr hf get black-forest-labs/FLUX.1-schnell
# List safetensor files only
tsr hf files black-forest-labs/FLUX.1-schnell
# Download a specific safetensor file
tsr hf dl black-forest-labs/FLUX.1-schnell -f ae.safetensors
# Download all safetensor files from a model
tsr hf dl author/model --all -o ./models
```
### Inspect Local Files
```bash
@@ -293,6 +317,18 @@ Data is stored in XDG-compliant paths:
| `--commercial` | none, image, rent, sell |
| `--page` | Page number for pagination |
## Hugging Face Options
| Option | Description |
|--------|-------------|
| `-a, --author` | Filter by author/organization |
| `-p, --pipeline` | Pipeline tag (text-to-image, text-generation, etc.) |
| `-s, --sort` | Sort by (downloads, likes, created_at, trending_score) |
| `-n, --limit` | Number of results (default: 25) |
| `-f, --file` | Specific file to download |
| `--all` | Download all safetensor files |
| `-o, --output` | Output directory |
## Generate Options
| Option | Description |