Sunday, May 28, 2023

2023-05-27

Automatic 1111 Stable Diffusion web UI

New installation

Webui version: v1.3.0
Python: 3.10.9
Torch: 2.0.1+cu118
Xformers: N/A (python 2.0 replace xformers completly)
Gradio: 3.31.0

(torch 2 is approximatly twice the speed on gtx 4080 for image generation)

Installation

1
Install GIT (add to path)

2
Install Python for windows

3
Make a new folder to install the web ui in





Go into the new folder

(windows 11)
Left click inside folder to open a prompt



Type this command in the window:
Git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git .


Press enter, wait for it to finish

inside the folder you created, Execute:
webui-user.bat
Wait for the downloads to finish (3.97 gig is the longest gig)


Just after the last big download, you will see a link to open the web ui:




In windows 11 you can just CTRL click the link to open it:
http://127.0.0.1:7860

The webui is installed, but not very fast

1st generation:
masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, miley cyrus wearing tracer costume from overwatch

Steps: 30, Sampler: Euler a, CFG scale: 7, Seed: 3011927377, Size: 512x512, Model hash: 6ce0161689, Model: v1-5-pruned-emaonly, Denoising strength: 0.7, Hires upscale: 2, Hires steps: 25, Hires upscaler: Latent, Version: v1.3.0

Time taken: 6.77s Torch active/reserved: 4265/5340 MiB, Sys VRAM: 7772/16376 MiB (47.46%)

4
Optimisation
We can do much better than that on a gtx 4080

Close the webui
Close the dos windows with the python stuff in it


Edit the file:

Change this line: (tested only on gtx 4080)
Set COMMANDLINE_ARGS=  --opt-sdp-attention --opt-channelslast --no-half-vae
Add this line:
set safetensors_fast_gpu=1
You can also add this line to update the ui each time you run it:
git pull


Reopen thewebui

 

Get last generation parameters:



Now on my old setup, this was the time (but i was already on torch 2.0, i updated it manually)

masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, miley cyrus wearing tracer costume from overwatch

Steps: 30, Sampler: Euler a, CFG scale: 7, Seed: 3011927377, Size: 512x512, Model hash: 6ce0161689, Model: v1-5-pruned-emaonly, Denoising strength: 0.7, Version: v1.2.1, Hires upscale: 2, Hires steps: 25, Hires upscaler: Latent

Time taken: 8.93sTorch active/reserved: 6863/7732 MiB, Sys VRAM: 10164/16376 MiB (62.07%)

So in this new torch 2 version of the webui, addin the 3 parameters on the command line changed nothing in the speed: (it took a little more ram, but one of the parameter do that)

masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, miley cyrus wearing tracer costume from overwatch

Steps: 30, Sampler: Euler a, CFG scale: 7, Seed: 172152486, Size: 512x512, Model hash: 6ce0161689, Model: v1-5-pruned-emaonly, Denoising strength: 0.7, Hires upscale: 2, Hires steps: 25, Hires upscaler: Latent, Version: v1.3.0

Time taken: 7.69s Torch active/reserved: 6855/7718 MiB, Sys VRAM: 10142/16376 MiB (61.93%)

Now for DPM++ (all version i think)
It is broken with torch 2.0, but only in this version, my precedent version was fine. (even with torch 2.0.0)
Broken = very ugly images, even at 100 sampling steps


Now with juggernaut_v18.safetensors [3f0f3a35e2]
Euler A


There ia blurry edge on the image, but not everywhere

masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, miley cyrus wearing tracer costume from overwatch

Steps: 100, Sampler: Euler a, CFG scale: 7, Seed: 172152486, Size: 512x512, Model hash: 3f0f3a35e2, Model: juggernaut_v18, Denoising strength: 0.35, Hires upscale: 2, Hires steps: 25, Hires upscaler: Latent, Version: v1.3.0

Time taken: 10.63sTorch active/reserved: 6864/7742 MiB, Sys VRAM: 10182/16376 MiB (62.18%)

So i removed my presonalisations in the webui-user.bat, same result







masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, miley cyrus wearing tracer costume from overwatch

Steps: 100, Sampler: Euler a, CFG scale: 7, Seed: 172152486, Size: 512x512, Model hash: 3f0f3a35e2, Model: juggernaut_v18, Denoising strength: 0.35, Hires upscale: 2, Hires steps: 25, Hires upscaler: Latent, Version: v1.3.0

Time taken: 9.74sTorch active/reserved: 4257/5320 MiB, Sys VRAM: 7744/16376 MiB (47.29%)

A little faster tho, so i do not need the folowing personalisations in the webui-user.bat:
Delete parameters, even the one for fast gpu: (it is probably integrated in the ui parameters now)

It a little faster and take less ram without the personalisations i was using when i implemented torch 2.0.0 myself in the old webui.

But a new problem arised:
Blurry edges around the characters body, strangly, not the face (100 sampling step)

Testing random seeds now... 

Model (H:\sdwebui\models\Stable-diffusion, YAML needed))
juggernaut_v18.safetensors [3f0f3a35e2])
juggernaut_v18.yaml

One image on 3 had the blur:




(3 images batch count)

masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, miley cyrus wearing tracer costume from overwatch

Steps: 100, Sampler: Euler a, CFG scale: 7, Seed: 3358036764, Size: 512x512, Model hash: 3f0f3a35e2, Model: juggernaut_v18, Denoising strength: 0.35, Hires upscale: 2, Hires steps: 25, Hires upscaler: Latent, Version: v1.3.0

Time taken: 29.24s Torch active/reserved: 4257/5320 MiB, Sys VRAM: 7744/16376 MiB (47.29%)

I removed some words in promt and addes negative prompts
No change, still some blurs in costume:



DPM++ SDE Karras not really working:
(even the face have blurs)



Now i noticed it was the Hires. fix breaking things (DPM++ with latent hires fix)
hires fix: ESRGAN 4x was ok
hires fix: latent: broken with DPM++


Next image (30 steps) was ok:

masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, miley cyrus wearing tracer costume from overwatch

Negative prompt: child, painting, drawing, sketch, cartoon, anime, render, blurry, deformed, disfigured, morbid, mutated, bad anatomy, bad art, disembodied limb, disembodied hand, portrait, floating hand, floating leg, floating arm, telephoto lens, dislocated limb, sprain, fracture, bad theet
Steps: 30, Sampler: DPM++ SDE Karras, CFG scale: 7, Seed: 3358036764, Size: 512x512, Model hash: 3f0f3a35e2, Model: juggernaut_v18, Denoising strength: 0.35, Hires upscale: 2, Hires steps: 25, Hires upscaler: ESRGAN_4x, Version: v1.3.0

Time taken: 13.46sTorch active/reserved: 4575/5438 MiB, Sys VRAM: 7890/16376 MiB (48.18%)



I did 6 images to be sure: (in batch count)

masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, miley cyrus wearing tracer costume from overwatch

Negative prompt: child, painting, drawing, sketch, cartoon, anime, render, blurry, deformed, disfigured, morbid, mutated, bad anatomy, bad art, disembodied limb, disembodied hand, portrait, floating hand, floating leg, floating arm, telephoto lens, dislocated limb, sprain, fracture, bad theet
Steps: 30, Sampler: DPM++ SDE Karras, CFG scale: 7, Seed: 3358036764, Size: 512x512, Model hash: 3f0f3a35e2, Model: juggernaut_v18, Denoising strength: 0.35, Hires upscale: 2, Hires steps: 25, Hires upscaler: ESRGAN_4x, Version: v1.3.0

Time taken: 1m 21.66sTorch active/reserved: 4581/5448 MiB, Sys VRAM: 7900/16376 MiB (48.24%)



3 images batch count time: (DPM++ take a lot of ram)

masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, miley cyrus wearing tracer costume from overwatch

Negative prompt: child, painting, drawing, sketch, cartoon, anime, render, blurry, deformed, disfigured, morbid, mutated, bad anatomy, bad art, disembodied limb, disembodied hand, portrait, floating hand, floating leg, floating arm, telephoto lens, dislocated limb, sprain, fracture, bad theet

Steps: 30, Sampler: DPM++ SDE Karras, CFG scale: 7, Seed: 1170825575, Size: 512x512, Model hash: 3f0f3a35e2, Model: juggernaut_v18, Denoising strength: 0.35, Hires upscale: 2, Hires steps: 25, Hires upscaler: ESRGAN_4x, Version: v1.3.0

Time taken: 41.59s Torch active/reserved: 4570/14874 MiB, Sys VRAM: 16376/16376 MiB (100.0%)

3 images batch size:

masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, miley cyrus wearing tracer costume from overwatch

Negative prompt: child, painting, drawing, sketch, cartoon, anime, render, blurry, deformed, disfigured, morbid, mutated, bad anatomy, bad art, disembodied limb, disembodied hand, portrait, floating hand, floating leg, floating arm, telephoto lens, dislocated limb, sprain, fracture, bad theet

Steps: 30, Sampler: DPM++ SDE Karras, CFG scale: 7, Seed: 1177518657, Size: 512x512, Model hash: 3f0f3a35e2, Model: juggernaut_v18, Denoising strength: 0.35, Hires upscale: 2, Hires steps: 25, Hires upscaler: ESRGAN_4x, Version: v1.3.0

Time taken: 38.80s Torch active/reserved: 9525/10216 MiB, Sys VRAM: 12668/16376 MiB (77.36%)

Just a little faster

3 images batch size Euler a: (much faster)
(note that it is hires 1024 x 1024, 7 sec / image in euler a 512 x 512)

masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, miley cyrus wearing tracer costume from overwatch

Negative prompt: child, painting, drawing, sketch, cartoon, anime, render, blurry, deformed, disfigured, morbid, mutated, bad anatomy, bad art, disembodied limb, disembodied hand, portrait, floating hand, floating leg, floating arm, telephoto lens, dislocated limb, sprain, fracture, bad theet

Steps: 30, Sampler: Euler a, CFG scale: 7, Seed: 3422560359, Size: 512x512, Model hash: 3f0f3a35e2, Model: juggernaut_v18, Denoising strength: 0.35, Hires upscale: 2, Hires steps: 25, Hires upscaler: ESRGAN_4x, Version: v1.3.0

Time taken: 21.84s Torch active/reserved: 9560/10252 MiB, Sys VRAM: 12874/16376 MiB (78.62%)


Installing controlnet
sd-webui-controlnet manipulations
After: close webui, close python (dos window) then restart


Controlnet come with 0 models by default:


Download them from here: (or internet)
https://huggingface.co/lllyasviel/ControlNet-v1-1/tree/main

Control net was ok, and canny see the hair color now? Is this new?



Now:
And:

Enabled controlnet
Latent couple
Composable lora
APPLY

Prompt:


floor
AND masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, miley cyrus wearing tracer costume from overwatch
AND masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, jennifer lawrence wearing widowmaker costume from overwatch

Negative prompt: child, painting, drawing, sketch, cartoon, anime, render, blurry, deformed, disfigured, morbid, mutated, bad anatomy, bad art, disembodied limb, disembodied hand, portrait, floating hand, floating leg, floating arm, telephoto lens, dislocated limb, sprain, fracture, bad theet
Steps: 30, Sampler: Euler a, CFG scale: 7, Seed: 1340533486, Size: 600x512, Model hash: 3f0f3a35e2, Model: juggernaut_v18, Denoising strength: 0.35, ControlNet: "preprocessor: canny, model: control_v11p_sd15_canny [d14c016b], weight: 1, starting/ending: (0, 1), resize mode: Crop and Resize, pixel perfect: False, control mode: Balanced, preprocessor params: (512, 100, 200)", Hires upscale: 1.7, Hires steps: 25, Hires upscaler: ESRGAN_4x, Version: v1.3.0

Time taken: 47.01sTorch active/reserved: 5447/8366 MiB, Sys VRAM: 10806/16376 MiB (65.99%)

Latent couple still not working, even after 6 images: (it merge the tow faces)
(controlnet to canny)


Prompt for composable lora latent couple:

floor
AND masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, woman miley cyrus wearing tracer costume from overwatch
AND masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, man steeve rogers as captain america

Tried Depth:


Depth gave ma a captain america, but female:


Open pose:


Captain is still a female:


scribble:


Still no captain america male:


Checked this in setting, not working:

2 control net models
Allow script to control controlnet extension

Loaded defautl 1.5 model:

More ugly, but captain is still not a male:



Changed to DPM++ 2m SDE karas
no captain yet


vérified my scribble, look ok:



Delete folder in extensions there: 

Installed this version:
https://github.com/SoCuteShibe/stable-diffusion-webui-two-shot.git

Extension in webui
Install from url

Captain is still a woman: (but the costume is there...)


new prompt:

floor
AND masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, miley cyrus wearing tracer costume from overwatch
AND masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, steeve rogers as captain america

Still:



Very simple prompt:

floor
AND miley cyrus wearing tracer costume from overwatch
AND steeve rogers as captain america

Openpose (no female or male i presume in open pose)

Partial work!



So back to complicated prompt:
with openpose:

floor
AND masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, miley cyrus wearing tracer costume from overwatch
AND masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, jennifer lawrence wearing widowmaker costume from overwatch

Changed to euler a
No hiresfix
control net on
latent couple on
composable lora on

Prompt...:
floor
AND masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, miley cyrus wearing tracer costume from overwatch
AND masterpiece, best quality, (high resolution:1.6), 8k, 2k, 4k, 16k, (open pores, skin imperfections), insane details, sharp focus, grain:0.5, perfect proportions, rule of thirds, hayden pennetiere wearing widowmaker costume from overwatch


Negative prompt: child, painting, drawing, sketch, cartoon, anime, render, blurry, deformed, disfigured, morbid, mutated, bad anatomy, bad art, disembodied limb, disembodied hand, portrait, floating hand, floating leg, floating arm, telephoto lens, dislocated limb, sprain, fracture, bad theet
Steps: 30, Sampler: Euler a, CFG scale: 7, Seed: 2700467051, Size: 1360x1024, Model hash: 3f0f3a35e2, Model: juggernaut_v18, ControlNet 0: "preprocessor: openpose_full, model: control_v11p_sd15_openpose [cab727d4], weight: 1, starting/ending: (0, 1), resize mode: Crop and Resize, pixel perfect: False, control mode: Balanced, preprocessor params: (512, 100, 200)", Version: v1.3.0

Time taken: 50.86sTorch active/reserved: 7832/11774 MiB, Sys VRAM: 14397/16376 MiB (87.92%)

Result...:


It's still a mix of Hayden and Miley, not two separate person
But hey, not bad for no hires fix, this model is amazing: juggernaut_v18.safetensors [3f0f3a35e2] (of course this is a controlnet with weight still)

I still have the costumes, not the face:


floor
AND miley cyrus wearing tracer costume
AND hayden pennetiere wearing widowmaker costume


Negative prompt: child, painting, drawing, sketch, cartoon, anime, render, blurry, deformed, disfigured, morbid, mutated, bad anatomy, bad art, disembodied limb, disembodied hand, portrait, floating hand, floating leg, floating arm, telephoto lens, dislocated limb, sprain, fracture, bad theet
Steps: 30, Sampler: Euler a, CFG scale: 7, Seed: 3709915190, Size: 1360x1024, Model hash: 3f0f3a35e2, Model: juggernaut_v18, ControlNet 0: "preprocessor: openpose_full, model: control_v11p_sd15_openpose [cab727d4], weight: 1, starting/ending: (0, 1), resize mode: Crop and Resize, pixel perfect: False, control mode: Balanced, preprocessor params: (512, 100, 200)", Version: v1.3.0

Time taken: 51.09sTorch active/reserved: 7832/11774 MiB, Sys VRAM: 14415/16376 MiB (88.03%)

-----

Tried with parameters in the command line:
floor 
AND miley cyrus
AND hayden pennetiere
Latent Couple: "divisions=1:1,1:2,1:2 positions=0:0,0:0,0:1 weights=0.2,0.8,0.8 end at step=20"

not working

-----
Latent couple two shot
Tried with masks instead of controlnet with openpose
Not working either