Update README.md
Browse files
README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
-
|
| 4 |
tags:
|
| 5 |
- image-classification
|
| 6 |
- multi-label-classification
|
|
@@ -49,11 +48,45 @@ backbone fine-tuned end-to-end with a single linear projection head.
|
|
| 49 |
|
| 50 |
## Usage
|
| 51 |
|
| 52 |
-
###
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
```bash
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
| 56 |
|
|
|
|
|
|
|
|
|
|
| 57 |
python tagger_ui_server.py \
|
| 58 |
--checkpoint tagger_proto.safetensors \
|
| 59 |
--vocab tagger_vocab_with_categories_and_alias_updated.json \
|
|
@@ -61,14 +94,37 @@ python tagger_ui_server.py \
|
|
| 61 |
# → open http://localhost:7860
|
| 62 |
```
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
## Files
|
| 65 |
|
| 66 |
| File | Description |
|
| 67 |
|---|---|
|
| 68 |
-
| `
|
| 69 |
-
| `
|
| 70 |
-
| `
|
|
|
|
|
|
|
| 71 |
| `tagger_ui_server.py` | FastAPI + Jinja2 web UI server |
|
|
|
|
| 72 |
|
| 73 |
## Tag Vocabulary
|
| 74 |
|
|
@@ -85,8 +141,7 @@ Minimum tag frequency threshold: **50** occurrences across the combined dataset.
|
|
| 85 |
|
| 86 |
## Limitations
|
| 87 |
|
| 88 |
-
- Evaluated on booru-style illustrations and furry art; performance on photographic
|
| 89 |
-
images or other art styles is untested.
|
| 90 |
- The vocabulary reflects the biases of e621 and Danbooru annotation practices.
|
| 91 |
|
| 92 |
## License
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
| 3 |
tags:
|
| 4 |
- image-classification
|
| 5 |
- multi-label-classification
|
|
|
|
| 48 |
|
| 49 |
## Usage
|
| 50 |
|
| 51 |
+
### 1. Install dependencies
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
pip install -r requirements.txt
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
Or manually:
|
| 58 |
+
|
| 59 |
+
```bash
|
| 60 |
+
pip install torch torchvision safetensors Pillow requests \
|
| 61 |
+
python-multipart fastapi uvicorn jinja2 aiofiles
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
### 2. Download model files
|
| 65 |
+
|
| 66 |
+
```bash
|
| 67 |
+
huggingface-cli download lodestones/taggerine \
|
| 68 |
+
tagger_proto.safetensors \
|
| 69 |
+
tagger_vocab_with_categories_and_alias_updated.json \
|
| 70 |
+
tagger_ui_server.py \
|
| 71 |
+
inference_tagger_standalone.py \
|
| 72 |
+
--local-dir .
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
> **Note:** `tagger_proto.safetensors` is ~5.3 GB. Make sure you have enough disk space.
|
| 76 |
+
|
| 77 |
+
### 3. Download the `tagger_ui/` templates folder
|
| 78 |
+
|
| 79 |
+
The server requires the `tagger_ui/templates/` directory to be present alongside `tagger_ui_server.py`:
|
| 80 |
|
| 81 |
```bash
|
| 82 |
+
huggingface-cli download lodestones/taggerine \
|
| 83 |
+
--include "tagger_ui/**" \
|
| 84 |
+
--local-dir .
|
| 85 |
+
```
|
| 86 |
|
| 87 |
+
### 4. Run the Web UI
|
| 88 |
+
|
| 89 |
+
```bash
|
| 90 |
python tagger_ui_server.py \
|
| 91 |
--checkpoint tagger_proto.safetensors \
|
| 92 |
--vocab tagger_vocab_with_categories_and_alias_updated.json \
|
|
|
|
| 94 |
# → open http://localhost:7860
|
| 95 |
```
|
| 96 |
|
| 97 |
+
**CPU-only machine?** Add `--device cpu` (inference will be slower):
|
| 98 |
+
|
| 99 |
+
```bash
|
| 100 |
+
python tagger_ui_server.py \
|
| 101 |
+
--checkpoint tagger_proto.safetensors \
|
| 102 |
+
--vocab tagger_vocab_with_categories_and_alias_updated.json \
|
| 103 |
+
--device cpu \
|
| 104 |
+
--port 7860
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
### Standalone CLI inference (no server)
|
| 108 |
+
|
| 109 |
+
```bash
|
| 110 |
+
python inference_tagger_standalone.py \
|
| 111 |
+
--checkpoint tagger_proto.safetensors \
|
| 112 |
+
--vocab tagger_vocab_with_categories_and_alias_updated.json \
|
| 113 |
+
--images photo.jpg \
|
| 114 |
+
--topk 30
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
## Files
|
| 118 |
|
| 119 |
| File | Description |
|
| 120 |
|---|---|
|
| 121 |
+
| `tagger_proto.safetensors` | Model weights (bfloat16) |
|
| 122 |
+
| `tagger_vocab_with_categories_and_alias_updated.json` | `{"idx2tag": [...], "tag2category": {...}}` — 74 625 tags with category metadata |
|
| 123 |
+
| `tagger_vocab_with_categories.json` | Same without alias data |
|
| 124 |
+
| `tagger_vocab.json` | Minimal vocab — `{"idx2tag": [...]}` only |
|
| 125 |
+
| `inference_tagger_standalone.py` | Self-contained CLI inference script (no `transformers` dep) |
|
| 126 |
| `tagger_ui_server.py` | FastAPI + Jinja2 web UI server |
|
| 127 |
+
| `requirements.txt` | Python dependencies |
|
| 128 |
|
| 129 |
## Tag Vocabulary
|
| 130 |
|
|
|
|
| 141 |
|
| 142 |
## Limitations
|
| 143 |
|
| 144 |
+
- Evaluated on booru-style illustrations and furry art; performance on photographic images or other art styles is untested.
|
|
|
|
| 145 |
- The vocabulary reflects the biases of e621 and Danbooru annotation practices.
|
| 146 |
|
| 147 |
## License
|