ThereforeGames / unprompted

Templating language written for Stable Diffusion workflows. Available as an extension for the Automatic1111 WebUI.
777 stars 66 forks source link

zoom_enhance with controlnet crashes, python stack strace #201

Open jpentland opened 1 year ago

jpentland commented 1 year ago

Due diligence

Describe the bug

If I use the following prompt:

man standing in a city street, pro wrestler, cyberpunk [after][zoom_enhance replacement="tiger head"][/after]

This seems to work ok. However, I want to increase the denoising strength, and use controlnet to ensure that the replaced image matches the surrounding image. So I would change the prompt to this:

man standing in a city street, pro wrestler, cyberpunk [after][zoom_enhance controlnet_preset=inpainting denoising_strength=0.8 replacement="tiger head"][/after]

With the "inpainting" file created at extensions/unprompted/templates/common/presets/controlnet/inpainting.txt:

[sets 
 cn_0_enabled=1 cn_0_pixel_perfect=1 cn_0_module=inpaint_only cn_0_model=control_v11p_sd15_inpaint cn_0_weight=1.0 cn_0_control_mode=1
 ]

The values inpaint_only and control_v11p_sd15_inpaint were copied from the controlnet extension list of options, which works if selected in the controlnet extension on the img2img tab.

However, when running this I get the following result:

Prompt

see above

Log output

see above

Unprompted version

Unprompted v9.16.1

WebUI version

v1.6.0-60-g7ab82787

Other comments

ControlNet v1.1.410

ComplexRobot commented 1 year ago

I browsed though the source code, and to my understanding, unprompted doesn't set the controlnet image value automatically (the error is saying it expects a numpy array, AKA the image, but it's receiving nothing). The expected result would be to do something like adetailer and automatically set the controlnet image to the current output (with the generated mask, if applicable). With unprompted, all you can do is set the controlnet image as a path to a file. Hopefully that functionality will be added, but as of right now all you can do is write a custom shortcode (python code) to do this, or you're stuck with manually setting the image in the controlnet UI (useless without the mask).