-
-
Notifications
You must be signed in to change notification settings - Fork 137
Prompt Engineering and Samplers
Each model has a different way of prompting, you can think of it like having it's own language, for example anime models use danbooru tags, while some realistic models don't support them but there are also realistic model that use those tags! so it's important to keep experimenting to find the best way to use a model.
Using negative prompts can improve the image a lot, below is an example negative prompt:
lowres, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck
(taken from here)
for duplicate things in the image:
(double), (duplicate)
for watermarks you just use (watermark, signature, username)
, however, this is not recommended as it can change the image in unexpected ways. instead, inpaint the watermark.
for anime, in addition to the above prompt you can also use:
illustration, 3d, lowres, low quality, cartoon, sketch, painting, analogphoto, analog
for better quality images, some models use (low quality, worst quality:1.2)
there are quite a few different samplers in AI Horde some of them are explained below, however keep in mind that this is just a general overview and different models work well with different samplers, it's important to experiment.
k_euler: this is all around best sampler, you can set the sampler to this forever and be fine, around 20 steps is enough to get good images.
k_euler_a: this also one of the best samplers.
k_lms: requires a very high number of steps to generate.
k_dpm_adaptive: this one chooses the number of steps automatically depending on the noise, SH calculates kudos for this as 50 steps.
k_dpm_fast: Supposed to be faster but in practice there is no point since it requires higher step count, which will take more time so the actual time required will be pretty much the same as other samplers, also doesn't seem to be great for anime.
k_dpmpp_sde: seems to only work well at above 30 steps, sharp and good for anime.
k_dpmpp_2m: this one is apparently supposed to work well at low steps but that doesn't seem to be the case in SH for some reason, it require atleast 20 steps.
these samplers double their steps, and require twice as much kudos:
k_heun: may have more details but takes longer to generate.
k_dpm_2: can create sharper images, good for anime.
k_dpm_2_a: either I don't know how to use it or something is wrong with this sampler, because I couldn't get a decent image even at 50 steps.
k_dpmpp_2s_a: this one also requires higher step count.
ancestral (samplers with _a the end) samplers add a bit of noise in each step because of this, the image generated will be slightly different every time, even with the same seed.
Links:
- Stable Diffusion with 🧨 Diffusers
- Which Stable Diffusion Sampler is Best? - Comparison With Step Counts
- Sampling Methods List
-
Useful explanation on samplers
Note - take the above links with a pinch of salt, they may have incorrect info.