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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model:
|
| 4 |
+
- OpenMOSS-Team/MOSS-Image-Base
|
| 5 |
+
pipeline_tag: text-to-image
|
| 6 |
+
tags:
|
| 7 |
+
- anime
|
| 8 |
+
- furry
|
| 9 |
+
- danbooru
|
| 10 |
+
- e621
|
| 11 |
+
- gelbooru
|
| 12 |
+
- finetune
|
| 13 |
+
- moss-image
|
| 14 |
+
- artist-style
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# MossAD-Demo - 57 Artist Style Test Full Finetune of OpenMOSS's MOSS-Image 5B
|
| 18 |
+
<p align="center">
|
| 19 |
+
<img src="https://huggingface.co/RicemanT/MossAD-Demo/resolve/main/images/cover.png" width="60%" />
|
| 20 |
+
</p>
|
| 21 |
+
ALL PREVIEW IMAGES HAVE COMFYUI METADATA.
|
| 22 |
+
|
| 23 |
+
<table>
|
| 24 |
+
<tr>
|
| 25 |
+
<td width="25%"><img src="https://huggingface.co/RicemanT/MossAD-Demo/resolve/main/images/01.png" width="100%"/></td>
|
| 26 |
+
<td width="25%"><img src="https://huggingface.co/RicemanT/MossAD-Demo/resolve/main/images/02.png" width="100%"/></td>
|
| 27 |
+
<td width="25%"><img src="https://huggingface.co/RicemanT/MossAD-Demo/resolve/main/images/03.png" width="100%"/></td>
|
| 28 |
+
<td width="25%"><img src="https://huggingface.co/RicemanT/MossAD-Demo/resolve/main/images/04.png" width="100%"/></td>
|
| 29 |
+
</tr>
|
| 30 |
+
<tr>
|
| 31 |
+
<td width="25%"><img src="https://huggingface.co/RicemanT/MossAD-Demo/resolve/main/images/05.png" width="100%"/></td>
|
| 32 |
+
<td width="25%"><img src="https://huggingface.co/RicemanT/MossAD-Demo/resolve/main/images/06.png" width="100%"/></td>
|
| 33 |
+
<td width="25%"><img src="https://huggingface.co/RicemanT/MossAD-Demo/resolve/main/images/07.png" width="100%"/></td>
|
| 34 |
+
<td width="25%"><img src="https://huggingface.co/RicemanT/MossAD-Demo/resolve/main/images/08.png" width="100%"/></td>
|
| 35 |
+
</tr>
|
| 36 |
+
</table>
|
| 37 |
+
|
| 38 |
+
---
|
| 39 |
+
|
| 40 |
+
## I. Introduction
|
| 41 |
+
|
| 42 |
+
***MossAD-Demo*** is a Danbooru/Gelbooru/E621 proof of concept Full-Finetune of OpenMOSS's MOSS-Image Base 5B T2I model, trained on a small curated 3,685 images dataset of 57 artists, as a way to test how fast and how well MOSS-Image learns artist styles, booru tags prompting and layout (bounding box) prompting before committing to a much bigger run.
|
| 43 |
+
|
| 44 |
+
The test is a big ass success: after only ~39 hours on a single AMD MI300X (ok I know it's alot for just 3k image on this kind of gpu, but i received the compute very suddenly and didn't have the luxury to optimize training), the styles land at around 90% accuracy, they carry over to subjects the artist never drew (a furry artist's style on anime girls, and the other way around), and hands are solid enough barring some exceptions here and there.
|
| 45 |
+
|
| 46 |
+
~ What the pilot found, and what the next big run will use:
|
| 47 |
+
|
| 48 |
+
* MOSS-Image learns styles fast: ~4.5k views per artist at 512px already gives 70-75% style accuracy, ~7k views gives 85-90% with the style carrying over to other subjects, while ~4k views only shows the style in the artist's own domain (furry artist styles only on furry gens)
|
| 49 |
+
* Most of the training can stay at cheap 512px, with shorter 768px and 1024px stages for hands, details and texture
|
| 50 |
+
* The learning rate needs to be halved at every higher resolution stage (4e-5 → 2e-5 → 1e-5), carrying the 512px LR into 768px made it unstable within 5 epochs and the stage had to be restarted
|
| 51 |
+
* The base model already understands panels and boxes from ComfyUI's default bbox node, and the finetune keeps that working with the trained styles
|
| 52 |
+
* Watermarks REALLY stick: if most of an artist's images share the same watermark, no tagging, captioning or negative prompt removes it. I will test masked training in the future to keep watermarks and signatures out of the loss if deemed viable and not too much of a hassle.
|
| 53 |
+
|
| 54 |
+
***Please scroll down to the generation recommendation section for the settings and the artist trigger.***
|
| 55 |
+
|
| 56 |
+
**Any donation will help with funding the full run, you can do so through:**
|
| 57 |
+
|
| 58 |
+
***Crypto (Prefered, cause Kofi/Paypal money transfer time is ass and they take a big cut)***
|
| 59 |
+
|
| 60 |
+
**0x6a4bc748cd0bb9ced9a360eb0eb79f4f106614f8 (USDT - BEP20 Network)**
|
| 61 |
+
|
| 62 |
+
**12PPVYUeS1MerNp38Tpns5qXR6cmhu9tws (Bitcoin - BTC Network)**
|
| 63 |
+
|
| 64 |
+
**0x6a4bc748cd0bb9ced9a360eb0eb79f4f106614f8 (Ethereum - ERC20 Network)**
|
| 65 |
+
|
| 66 |
+
**GKjLvD9XGAhyEpsZvEUNH5je9PFbrivoV5yBfYKGYskq (Solana - SOL network)**
|
| 67 |
+
|
| 68 |
+
Please handle your money carefully and make sure the address you're sending to is correct.
|
| 69 |
+
Please contact me through discord (user: talannnn) if you're donating with crypto, to make sure it goes through and you're not losing money.
|
| 70 |
+
|
| 71 |
+
***Ko-fi***
|
| 72 |
+
|
| 73 |
+
**https://ko-fi.com/talanartvn**
|
| 74 |
+
|
| 75 |
+
## II. Model Details
|
| 76 |
+
|
| 77 |
+
| | |
|
| 78 |
+
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
| 79 |
+
| **Base model** | [OpenMOSS's MOSS-Image Base 5B](https://huggingface.co/OpenMOSS-Team/MOSS-Image-Base) |
|
| 80 |
+
| **Method** | Full Finetune |
|
| 81 |
+
| **Trainer** | [My mage-flow-trainer fork](https://github.com/RicemanT/mage-flow-trainer) (of [Bluvoll's mage-flow-trainer](https://github.com/bluvoll/mage-flow-trainer)) |
|
| 82 |
+
| **Hardware** | 1x AMD MI300X 192GB (DigitalOcean AMD Developer Cloud), free compute from Disty |
|
| 83 |
+
| **Total training time** | ~39 hours of MI300X for the final model (~55 hours including LR tests and the restarted stage) |
|
| 84 |
+
| **Total samples seen** | ~457k (~8k views per artist) |
|
| 85 |
+
| **Training resolutions** | 512² → 768² → 1024², mixed aspect ratios packed with varlen attention |
|
| 86 |
+
|
| 87 |
+
### Training run
|
| 88 |
+
|
| 89 |
+
**Budget:** 0 dollars (free MI300X compute, thanks Disty!)
|
| 90 |
+
|
| 91 |
+
Full configs: [configs folder](https://huggingface.co/RicemanT/MossAD-Demo/tree/main/configs)
|
| 92 |
+
|
| 93 |
+
| Stage | Peak LR | Epochs | Steps | Effective batch | Views per artist | Time |
|
| 94 |
+
|---|---|---|---|---|---|---|
|
| 95 |
+
| 512px | 4e-5 | 70 | 560 | 512 (128 x 4) | ~4,550 | ~12.8h |
|
| 96 |
+
| 768px | 2e-5 | 40 | 600 | 256 (64 x 4) | ~2,600 | ~15.5h |
|
| 97 |
+
| 1024px | 1e-5 | 14 | 406 | 128 (32 x 4) | ~910 | ~10.5h |
|
| 98 |
+
|
| 99 |
+
- **LR scheduler:** Warmup (5%) -> Constant (55%) -> REX to 0 (40%), for every stage
|
| 100 |
+
- **Precision:** Full BF16
|
| 101 |
+
- **Optimizer:** AdamW8bit (quantized state, no Kahan summation)
|
| 102 |
+
- **Attention:** torch varlen with packed resolutions (no caption padding, no bucketing tricks)
|
| 103 |
+
- **LR test:** 4e-5 vs 2e-5 at 512px for 10 epochs each, 4e-5 learned styles a lot faster and was continued
|
| 104 |
+
|
| 105 |
+
### Additional training features
|
| 106 |
+
|
| 107 |
+
- 16 caption variations per image
|
| 108 |
+
- Mixed captions at 25/10/15/15/25/20 ratio (tags only, short NL, medium NL, long NL, layout with bounding boxes, tags-nl)
|
| 109 |
+
- Layout captions: characters, objects, text, panels and character detail boxes, with short box captions in 30% of the layouts
|
| 110 |
+
- Tag dropout: 10%
|
| 111 |
+
- Caption dropout: 5%
|
| 112 |
+
- Tag shuffle
|
| 113 |
+
- Caption shuffle
|
| 114 |
+
- Artist trigger attribution system (the trigger always stays at the front)
|
| 115 |
+
|
| 116 |
+
---
|
| 117 |
+
|
| 118 |
+
## III. Recommended Settings
|
| 119 |
+
|
| 120 |
+
The model works in ComfyUI with its native MOSS-Image support: load the checkpoint as the diffusion model, together with the text encoder and VAE from [Comfy-Org/MOSS-Image](https://huggingface.co/Comfy-Org/MOSS-Image). These are the settings used for the sample images above (ComfyUI, the images have metadata):
|
| 121 |
+
|
| 122 |
+
- **Shift:** 5.0
|
| 123 |
+
- **Steps:** 30 (50 for best quality)
|
| 124 |
+
- **CFG:** 4
|
| 125 |
+
- **Sampler:** `euler`
|
| 126 |
+
- **Scheduler:** `simple`
|
| 127 |
+
- **Negative prompt:** worst quality, bad anatomy, watermark, jpeg artifact
|
| 128 |
+
|
| 129 |
+
These are just my usual settings and workflow — feel free to experiment.
|
| 130 |
+
|
| 131 |
+
The model also includes quality tags, you usually want to add them at the end of the tag section of the prompt, they are:
|
| 132 |
+
|
| 133 |
+
***masterpiece, best quality, very aesthetic, aesthetic***
|
| 134 |
+
|
| 135 |
+
***Artist Trigger:*** This model uses the **@artist name** trigger, if you want to use the model's built-in artist styles, please always put one at the start of your prompt (for example `@sakimichan, 1girl, ...` or `@sakimichan. A girl standing in the rain...`). The model supports 57 artists, please download to see: [MossAD-Demo-artists.csv](https://huggingface.co/RicemanT/MossAD-Demo/blob/main/MossAD-Demo-artists.csv). The characters the dataset covers are in [MossAD-Demo-characters.csv](https://huggingface.co/RicemanT/MossAD-Demo/blob/main/MossAD-Demo-characters.csv).
|
| 136 |
+
|
| 137 |
+
All three prompt styles work: booru tags, natural language, and MOSS layout prompts with bounding boxes (ComfyUI's default bbox node works). Tags-only prompts are a bit rougher than natural language and layout prompts, and text rendering is clearly better when the prompt spells out what the text says.
|
| 138 |
+
|
| 139 |
+
### Known issues
|
| 140 |
+
|
| 141 |
+
- Watermarks and signatures that most of an artist's images share can show up in gens
|
| 142 |
+
- Some gens look a little burned at 1024px
|
| 143 |
+
- Hands are solid most of the time, with some exceptions here and there
|
| 144 |
+
|
| 145 |
+
---
|
| 146 |
+
|
| 147 |
+
## IV. Dataset
|
| 148 |
+
|
| 149 |
+
3,685 images of 57 artists from Danbooru, Gelbooru and E621 (35-75 images per artist), collected and curated with my Illustration Scrapping Studio app, and captioned with SOTA API captioners into booru tags, three lengths of natural language captions and MOSS layout captions, with detector-assisted bounding boxes for text, watermarks, faces and panels.
|
| 150 |
+
|
| 151 |
+
---
|
| 152 |
+
|
| 153 |
+
## V. Notes from the Training Diary
|
| 154 |
+
|
| 155 |
+
Full pilot notes (stages, LR lessons, views per artist, ROCm setup): [MossAD-Demo pilot README](https://github.com/RicemanT/mage-flow-trainer/blob/main/scripts/mossad-demo/README.md)
|
| 156 |
+
|
| 157 |
+
---
|
| 158 |
+
|
| 159 |
+
## VI. License
|
| 160 |
+
|
| 161 |
+
This model is a Derivative of OpenMOSS's MOSS-Image and is distributed under the same **[Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0)** as the base model, with no additional restrictions.
|
| 162 |
+
|
| 163 |
+
---
|
| 164 |
+
|
| 165 |
+
## VII. Acknowledgments
|
| 166 |
+
|
| 167 |
+
Beeg thanks to:
|
| 168 |
+
|
| 169 |
+
- Disty — The free MI300X compute that made this whole test possible, the biggest thanks to them
|
| 170 |
+
- [OpenMOSS](https://huggingface.co/OpenMOSS-Team) — Creators of MOSS-Image, the gift that keeps on giving
|
| 171 |
+
- [Bluvoll](https://github.com/bluvoll/mage-flow-trainer) — Creator of mage-flow-trainer that my fork is derived from, and general training advice
|
| 172 |
+
- [Motimalu](https://civitai.red/user/motimalu) — Inspiration behind finetuning practices and configs, like lowering the LR at every resolution stage
|
| 173 |
+
- [KBlueLeaf](https://huggingface.co/KBlueLeaf) — MOSS training advice
|
| 174 |
+
- [Anzhc](https://huggingface.co/Anzhc) — Detection models used for the bounding box captions, and general training advice
|
| 175 |
+
- Format inspired by [Motimalu's Kirazuri diary](https://github.com/motimalu/diffusion-training-configs/blob/main/diffusion-pipe/anima/notes/kirazuri4.0-notes%20.md)
|