Upload README.md
Browse files
README.md
CHANGED
|
@@ -1,15 +1,71 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
**Name:** `t5_base_prompt_translator`
|
| 10 |
**Base Model:** T5-Base (Google)
|
| 11 |
**Parameters:** 220 million
|
| 12 |
-
**Training Data:** 95,000 high-quality
|
| 13 |
**Training Duration:** ~10 hours on RTX 4090
|
| 14 |
**Model Size:** ~850 MB
|
| 15 |
|
|
@@ -103,14 +159,65 @@ Base model: T5-Base (Google)
|
|
| 103 |
- T5-Base architecture
|
| 104 |
- WD14 v1.4 MOAT ground truth
|
| 105 |
|
| 106 |
-
|
| 107 |
|
| 108 |
-
|
| 109 |
-
- GitHub Issues: https://github.com/yourusername/tag_generator/issues
|
| 110 |
-
- Documentation: See PARAMETERS.md and README.md
|
| 111 |
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
-
|
| 115 |
|
| 116 |
-
**Model
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
base_model: google/t5-base
|
| 6 |
+
tags:
|
| 7 |
+
- text2text-generation
|
| 8 |
+
- prompt-engineering
|
| 9 |
+
- stable-diffusion
|
| 10 |
+
- image-generation
|
| 11 |
+
- wd14-tags
|
| 12 |
+
- comfyui
|
| 13 |
+
- t5
|
| 14 |
+
pipeline_tag: text2text-generation
|
| 15 |
+
widget:
|
| 16 |
+
- text: "translate prompt to tags: magical girl with blue hair in a garden"
|
| 17 |
+
example_title: "Magical Girl"
|
| 18 |
+
- text: "translate prompt to tags: cyberpunk city at night with neon lights"
|
| 19 |
+
example_title: "Cyberpunk City"
|
| 20 |
+
- text: "translate prompt to tags: cute cat sleeping on a windowsill"
|
| 21 |
+
example_title: "Cute Cat"
|
| 22 |
+
datasets:
|
| 23 |
+
- arcenciel
|
| 24 |
+
metrics:
|
| 25 |
+
- accuracy
|
| 26 |
+
model-index:
|
| 27 |
+
- name: t5-base-prompt-translator
|
| 28 |
+
results:
|
| 29 |
+
- task:
|
| 30 |
+
type: text2text-generation
|
| 31 |
+
name: Prompt to Tags Translation
|
| 32 |
+
metrics:
|
| 33 |
+
- type: accuracy
|
| 34 |
+
value: 87.5
|
| 35 |
+
name: Tag Matching Accuracy
|
| 36 |
+
---
|
| 37 |
+
|
| 38 |
+
# T5 Base Prompt Translator
|
| 39 |
+
|
| 40 |
+
Transform natural language descriptions into optimized WD14 tags for Stable Diffusion!
|
| 41 |
+
|
| 42 |
+
This model translates creative natural language prompts into standardized WD14-format tags, trained on 95,000 high-quality prompts from Arcenciel.io.
|
| 43 |
+
|
| 44 |
+
## Quick Start
|
| 45 |
|
| 46 |
+
```python
|
| 47 |
+
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
| 48 |
|
| 49 |
+
# Load model and tokenizer
|
| 50 |
+
tokenizer = T5Tokenizer.from_pretrained("Elldreth/t5_base_prompt_translator")
|
| 51 |
+
model = T5ForConditionalGeneration.from_pretrained("Elldreth/t5_base_prompt_translator")
|
| 52 |
|
| 53 |
+
# Translate a prompt
|
| 54 |
+
prompt = "translate prompt to tags: magical girl with blue hair in a garden"
|
| 55 |
+
inputs = tokenizer(prompt, return_tensors="pt", max_length=160, truncation=True)
|
| 56 |
+
outputs = model.generate(**inputs, max_length=256, num_beams=4)
|
| 57 |
+
tags = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 58 |
+
|
| 59 |
+
print(tags)
|
| 60 |
+
# Output: 1girl, blue hair, garden, outdoors, solo, long hair, dress, flowers, standing, day, smile, magical girl
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
## Model Details
|
| 64 |
|
| 65 |
**Name:** `t5_base_prompt_translator`
|
| 66 |
**Base Model:** T5-Base (Google)
|
| 67 |
**Parameters:** 220 million
|
| 68 |
+
**Training Data:** 95,000 high-quality prompts from Arcenciel.io
|
| 69 |
**Training Duration:** ~10 hours on RTX 4090
|
| 70 |
**Model Size:** ~850 MB
|
| 71 |
|
|
|
|
| 159 |
- T5-Base architecture
|
| 160 |
- WD14 v1.4 MOAT ground truth
|
| 161 |
|
| 162 |
+
## Use with ComfyUI
|
| 163 |
|
| 164 |
+
This model is designed to work with the [ComfyUI-T5X-Prompt-Translator](https://github.com/yourusername/ComfyUI-T5X-Prompt-Translator) custom node:
|
|
|
|
|
|
|
| 165 |
|
| 166 |
+
1. Install the custom node in ComfyUI
|
| 167 |
+
2. The model will auto-download on first use
|
| 168 |
+
3. Use the node to translate natural language to WD14 tags
|
| 169 |
+
4. Connect to CLIP Text Encode for image generation
|
| 170 |
+
|
| 171 |
+
See the [ComfyUI custom node repository](https://github.com/yourusername/ComfyUI-T5X-Prompt-Translator) for installation instructions.
|
| 172 |
+
|
| 173 |
+
## Intended Use
|
| 174 |
+
|
| 175 |
+
**Primary Use Case:** Converting creative natural language descriptions into optimized WD14-format tags for Stable Diffusion image generation.
|
| 176 |
+
|
| 177 |
+
**Example Applications:**
|
| 178 |
+
- Simplifying prompt creation for Stable Diffusion
|
| 179 |
+
- Standardizing prompts across different workflows
|
| 180 |
+
- Learning WD14 tag vocabulary
|
| 181 |
+
- Batch processing natural language descriptions
|
| 182 |
+
|
| 183 |
+
## Limitations
|
| 184 |
+
|
| 185 |
+
- Trained primarily on anime/illustration style prompts
|
| 186 |
+
- May not perform as well on photorealistic or other specialized domains
|
| 187 |
+
- Tag accuracy depends on similarity to training data
|
| 188 |
+
- Requires proper input format: `"translate prompt to tags: [your description]"`
|
| 189 |
+
|
| 190 |
+
## Training Data
|
| 191 |
+
|
| 192 |
+
- **Source:** Arcenciel.io public API
|
| 193 |
+
- **Size:** 95,000 image-prompt pairs
|
| 194 |
+
- **Filtering:** No quality or rating filters (maximum diversity)
|
| 195 |
+
- **Ground Truth:** WD14 v1.4 MOAT tagger by SmilingWolf
|
| 196 |
+
- **Format:** Escaped parentheses format for Stable Diffusion compatibility
|
| 197 |
+
|
| 198 |
+
**Note:** Quality filtering was intentionally avoided to maximize training data diversity. Engagement metrics (hearts, likes) are not consistently used across the source platform.
|
| 199 |
+
|
| 200 |
+
## Citation
|
| 201 |
+
|
| 202 |
+
```bibtex
|
| 203 |
+
@misc{t5-base-prompt-translator,
|
| 204 |
+
title={T5 Base Prompt Translator: Natural Language to WD14 Tags},
|
| 205 |
+
author={Elldreth},
|
| 206 |
+
year={2024},
|
| 207 |
+
publisher={Hugging Face},
|
| 208 |
+
howpublished={\url{https://huggingface.co/Elldreth/t5_base_prompt_translator}},
|
| 209 |
+
}
|
| 210 |
+
```
|
| 211 |
+
|
| 212 |
+
## Support & Links
|
| 213 |
+
|
| 214 |
+
- **ComfyUI Node:** https://github.com/yourusername/ComfyUI-T5X-Prompt-Translator
|
| 215 |
+
- **Issues:** https://github.com/yourusername/ComfyUI-T5X-Prompt-Translator/issues
|
| 216 |
+
- **Training Code:** https://github.com/yourusername/tag_generator
|
| 217 |
|
| 218 |
+
## Acknowledgments
|
| 219 |
|
| 220 |
+
- **Base Model:** T5-Base by Google Research
|
| 221 |
+
- **Training Data:** Arcenciel.io community
|
| 222 |
+
- **WD14 Tagger:** SmilingWolf's WD v1.4 MOAT tagger
|
| 223 |
+
- **Framework:** Hugging Face Transformers
|