🚀 DanTagGen - beta
DanTagGen (Danbooru Tag Generator) is a text - generation project inspired by p1atdev's dart project. It offers a unique approach with a different architecture, dataset, format, and training strategy, aiming to enhance the tag - generation process for Danbooru - related content.
✨ Features
- Version Differences:
- Alpha: Pretrained on a 2M dataset with a smaller batch size, resulting in limited generation ability.
- Beta: Pretrained on a 5.3M dataset with a larger batch size, offering more stability and better performance even with minimal input information.
- Model Architecture: Trained from scratch using a 400M - parameter LLaMA architecture (referred to as NanoLLaMA). It is theoretically compatible with any LLaMA inference interface.
- Model Formats: The repository provides converted FP16 gguf models and quantized 8 - bit/6 - bit gguf models, recommended to be run with llama.cpp or llama - cpp - python for high - speed performance.
- Dataset and Training: Trained for 10 epochs on 5.3M data, having seen approximately 6 - 12B tokens. The dataset is exported from HakuBooru using a custom - filtered Danbooru sqlite database.
- Utilities: A Gradio UI is under development, and plans are in place to create an sd - webui extension for wider application.
📦 Installation
No installation steps are provided in the original document, so this section is skipped.
💻 Usage Examples
Basic Usage
Example 1: Vivlos
Base prompt:
1girl,
vivlos \(umamusume\), umamusume,
kxl - delta - style1,
swimsuit,
masterpiece, newest, absurdres, sensitive
|
Without DTG |
DTG - Alpha |
DTG - Beta |
Prompts |
Base prompt |
Base prompt + "mole under eye, tail, twintails, open mouth, single ear cover, horse ears, breasts, looking at viewer, visor cap, streaked hair, long hair, horse tail, hair between eyes, cowboy shot, blue nails, purple eyes, covered navel, horse girl, competition swimsuit, blush, multicolored hair, collarbone, two - tone swimsuit, animal ears, mole, white hair, ear covers, smile, ear ornament, swimsuit, solo, blue eyes, brown hair, one - piece swimsuit, white headwear, medium breasts, white one - piece swimsuit, bare shoulders," |
Base prompt + "blue bikini, tail, twintails, single ear cover, horse ears, striped clothes, ear piercing, cleavage, breasts, blue ribbon, looking at viewer, ribbon, streaked hair, long hair, horse tail, hair between eyes, :3, purple eyes, horse girl, blush, multicolored hair, hair ribbon, collarbone, bikini skirt, piercing, animal ears, striped bikini, sitting, white hair, ear covers, :d, smile, swimsuit, solo, brown hair, ocean, white headwear, medium breasts, bikini," |
Result image |
 |
 |
 |
Performance |
It can't even generate vivlos |
It can generate an image with correct character features but lacks enough detail and some features are wrong or missing |
Significantly better than the alpha version, providing good character features, more details, and a better composition |
Example 2: Daring Tact
Base prompt:
1girl,
daring tact \(umamusume\), umamusume,
kxl - delta - style1,
horse girl, horse tail, horse ears, cafe, table, chair,
masterpiece, newest, absurdres, safe
|
Without DTG |
DTG - Alpha |
DTG - Beta |
Prompts |
Base prompt |
Base prompt + "plant, necktie, tail, indoors, skirt, looking at viewer, cup, lounge chair, green theme, book, alternate costume, potted plant, hair ornament, blue jacket, blush, medium hair, black necktie, green eyes, jacket, animal ears, black hair, round eyewear, bookshelf, adjusting eyewear, ahoge, smile, solo, window, brown hair, crossed legs, glasses, closed mouth, book stack," |
Base prompt + "jacket, sitting on table, food, tail, collar, horse racing, black hair, boots, school bag, bag, full body, blue eyes, hair ornament, animal ears, ahoge, sitting, thighhighs, blurry background, looking at viewer, school uniform, long hair, blurry, cup, window, crossed legs, alternate costume, medium breasts, breasts, calendar (object), casual, door, solo, disposable cup," |
Result image |
 |
 |
 |
Performance |
|
It can generate an image with more elements and details, but the coherence with the character is not good |
Significantly better than the alpha version, providing more details and a better composition |
Advanced Usage
The model uses the following format for input prompts:
prompt = f"""
rating: {rating or '<|empty|>'}
artist: {artist.strip() or '<|empty|>'}
characters: {characters.strip() or '<|empty|>'}
copyrights: {copyrights.strip() or '<|empty|>'}
aspect ratio: {f"{aspect_ratio:.1f}" or '<|empty|>'}
target: {'<|' + target + '|>' if target else '<|long|>'}
general: {", ".join(special_tags)}, {general.strip().strip(",")}<|input_end|>
"""
For example:
rating: safe
artist: <|empty|>
characters: <|empty|>
copyrights: <|empty|>
aspect ratio: 1.0
target: <|short|>
general: 1girl, solo, dragon girl, dragon horns, dragon tail<|input_end|>
And you may get an output like:
rating: safe
artist: <|empty|>
characters: <|empty|>
copyrights: <|empty|>
aspect ratio: 1.0
target: <|short|>
general: 1girl, solo, dragon girl, dragon horns, dragon tail<|input_end|>open mouth, red eyes, long hair, pointy ears, tail, black hair, chinese clothes, simple background, dragon, hair between eyes, horns, china dress, dress, looking at viewer, breasts
📚 Documentation
Model Arch
This version of DTG is trained from scratch using a 400M - parameter LLaMA architecture (referred to as NanoLLaMA). Since it is based on the LLaMA architecture, it can theoretically be used in any LLaMA inference interface. The repository also provides converted FP16 gguf models and quantized 8 - bit/6 - bit gguf models. It is recommended to use llama.cpp or llama - cpp - python to run this model for high - speed performance.
Dataset and Training
The training is conducted using a custom - implemented trainer in HakuPhi. The model is trained for 10 epochs on 5.3M data, having seen approximately 6 - 12B tokens. The dataset is exported from HakuBooru using a custom - filtered Danbooru sqlite database. The data is filtered based on the percentile of the fav_count for each rating (2M = top 25%, 5.3M = top 75%).
Utilities
A Gradio UI is currently being implemented for this project. Other developers can utilize the API within it to create different applications. Additionally, there are plans to develop an sd - webui extension.
📄 License
Property |
Details |
License |
OpenRail |
Property |
Details |
Model Type |
Text - generation |
Training Data |
KBlueLeaf/danbooru2023 - sqlite |
⚠️ Important Note
This project is tagged with "not - for - all - audiences" and "art". Please use it in compliance with relevant regulations and ethical standards.
💡 Usage Tip
When using the model, try different input prompts to get the best tag - generation results. You can adjust the rating
, artist
, characters
, etc., according to your needs.