Skip to content

p1atdev/sd-danbooru-tags-upsampler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sd-danbooru-tags-upsampler

日本語はこちら

An extension for Stable Diffusion Web UI that upsamples prompts by generating or completing danbooru tags using lightweight LLM.

It's useful for people who don't want think about long prompt or want to see diverse, natural and high quality images without any thinking.

Upsates

  • 2024/2/29: v0.2.0 has been released. New features; generation options, variety level and range ban tags.
  • 2024/2/25: v0.1.1 has been released. Handling of seeds, escaping processing of brackets and many bugs are fixed.
  • 2024/2/23: First version v0.1.0 has been released.

Usage

Scrennshot of this extension

Open the Danbooru Tags Upsampler accordion and check the Enabled checkbox to enable this extension.

Explanation of parameters:

Parameter name Description Example value
Total tag length This parameter can specify the amount of total tags after completing the positive prompt. Not the amount of completing tags. very short means "less than 10 tags", short means "less than 20 tags", long means "less than 40 tags" and very long is more than that. long is recommended
Ban tags All tags in this field will never appear in completion tags. It's useful when you don't want to contain some specific tags. Using * maches to any character. (e.g. * background matches to simple background, white background, ...) official alternate costume, english text, * background, ...
Seed for upsampling tags If this number and the positive prompt are fixed, the completion tags are also fixed. -1 means "generates tags using random seed every time" If you want to generate images with different final prompts every time, set to -1.
Upsampling timing When to upsample, before or after other prompt processing (e.g. sd-dynamic-prompts or webui's styles feature) are applied. After applying other prompt processings
Variety level These parameters are presets of the Generation config. This can change the variety of upsampled tags. varied
Generation config LLM parameters of generating tags. It's recommended not to touch if you are not familiar with language model's generation parameters, and use Variety level option instead.

Scrennshot of generation config options

Showcases

Input prompt Without upsampling With upsampling
1girl, solo, cowboy shot (seed: 2396487241) Sample image 1 generated without upsampling Sample image 1 generated with upsampling
(prompts used to generate) 1girl, solo, cowboy shot 1girl, solo, cowboy shot, ahoge, animal ears, bare shoulders, blue hair, blush, closed mouth, collarbone, collared shirt, dress, eyelashes, fox ears, fox girl, fox tail, hair between eyes, heart, long hair, long sleeves, looking at viewer, neck ribbon, ribbon, shirt, simple background, sleeves past wrists, smile, tail, white background, white dress, white shirt, yellow eyes
3girls (seed: 684589178) Sample image 2 generated without upsampling Sample image 2 generated with upsampling
(prompts used to generate) 3girls 3girls, black footwear, black hair, black thighhighs, boots, bow, bowtie, chibi, closed mouth, collared shirt, flower, grey hair, hair between eyes, hair flower, hair ornament, long hair, long sleeves, looking at viewer, multiple girls, purple eyes, red eyes, shirt, short hair, sitting, smile, thighhighs, vest, white shirt, white skirt
no humans, scenery (seed: 3702717413) Sample image 3 generated without upsampling Sample image 3 generated with upsampling
(prompts used to generate) no humans, scenery no humans, scenery, animal, animal focus, bird, blue eyes, cat, dog, flower, grass, leaf, nature, petals, shadow, sitting, star (sky), sunflower, tree
1girl, frieren, sousou no frieren (seed: 787304393) Sample image 4 generated without upsampling Sample image 4 generated with upsampling
(prompts used to generate) 1girl, frieren, sousou no frieren 1girl, frieren, sousou no frieren, black pantyhose, cape, closed mouth, elf, fingernails, green eyes, grey hair, hair between eyes, long hair, long sleeves, looking at viewer, pantyhose, pointy ears, simple background, skirt, solo, twintails, white background, white skirt

Generation settings:

  • Model: AnimagineXL 3.0
  • Negative prompt (same as the recommended settings of animaginexl 3.0):
nsfw, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, artist name

Upsampling settings:

  • Total tag length: long
  • Ban tags: none
  • Seed: -1
  • When to perform the process: Before applying styles

Variation levels

(The seeds are not the same.)

Input prompt Very unvaried Unvaried Normal Varied Very varied
1girl, solo, from side Variation sample image 1; very unvaried Variation sample image 1; unvaried Variation sample image 1; normal Variation sample image 1; varied Variation sample image 1; very varied
1girl, frieren, sousou no frieren, Variation sample image 2; very unvaried Variation sample image 2; unvaried Variation sample image 2; normal Variation sample image 2; varied Variation sample image 2; very varied
no humans, scenery Variation sample image 3; very unvaried Variation sample image 3; unvaried Variation sample image 3; normal Variation sample image 3; varied Variation sample image 3; very varied

Very unvaried and Unvaried mean less variety, but at the same time, faithful to the input prompt and generate relatively acceptable tags. Also, Very varied and Varied mean more variety, but tend to ignore the input prompt and often generate weird tags.

Access to the model weights

This extension uses the following model:

Want to use without sd webui?

A demo on 🤗 Space is avaiable, so you can try upsampling tags without installing this extension:

Demo: https://huggingface.co/spaces/p1atdev/danbooru-tags-transformer

How to change default values?

Open [webui's root directory]/ui-config.json, then find parameters staring with customscript/dart_upsampler.py/ and edit them.

If you feel that the default values are broken, you can delete parameters staring with customscript/dart_upsampler.py/txt2img/ to reset the default values.

Acknowledgements

This project has been influenced by the following projects and researches. We express our respect and gratitude to the developers and contributors of these projects: