đ DanTagGen - delta (rev2)
DanTagGen (Danbooru Tag Generator) is inspired by p1atdev's dart project. However, it features a different architecture, dataset, format, and training strategy.
đ Quick Start
This model is designed for text generation. You can use it with the transformers
library. For a quick test, you can use the provided widget on the Hugging Face page.
⨠Features
Difference between versions
- alpha: Pretrained on a 2M dataset with a smaller batch size. It has limited capabilities.
- beta: Pretrained on a 5.3M dataset with a larger batch size. It is more stable and performs better even with limited input information.
- delta: Pretrained on a 7.2M dataset with a larger batch size. It shows a slight underfitting but offers better diversity. A quality tag has been introduced.
- rev2: Resumed from the delta version, using the same dataset and trained for 2 more epochs.
Model arch
This version of DTG is trained from scratch with a 400M parameter LLaMA architecture (I personally refer to it as NanoLLaMA). Since it is based on the LLaMA architecture, it can theoretically be used with any LLaMA inference interface.
This repository also provides a converted FP16 gguf model and quantized 8-bit/6-bit gguf models. It is recommended to use llama.cpp
or llama-cpp-python
to run this model for optimal speed.
Format
prompt = f"""
quality: {quality or '<|empty|>'}
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|>
"""
Basic Usage
quality: masterpiece
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|>
Advanced Usage
After inputting the above prompt, you may get an output like this:
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
Dataset and Training
I used the trainer I implemented in HakuPhi to conduct the training. The model has been trained for a total of 12 epochs on a 7.2M dataset, and it has seen roughly 10 - 15B tokens.
The dataset is exported by HakuBooru using my 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%).
đ Documentation
Utilities
đ License
This project is licensed under the CC BY-SA 4.0 license.
Additional Information
Property |
Details |
Model Type |
Text Generation |
Training Data |
Exported by HakuBooru from Danbooru SQLite database, filtered based on fav_count percentile. 2M (top 25%), 5.3M (top 75%), 7.2M (used for delta and rev2) |
Library Name |
transformers |
Pipeline Tag |
text-generation |
Tags |
not-for-all-audiences, art |
â ī¸ Important Note
This model is tagged with not-for-all-audiences
. Please use it responsibly.
đĄ Usage Tip
When using the model, adjust the input parameters according to your needs to get the best results.