sd-webui-controlnet
sd-webui-controlnet copied to clipboard
Is it possible to disable the control net in Highres.fix process?
I try to use line art to generate colored anime pics. The low resolution output is pretty good, but also out of the origin lines. While in highres process, I believe the control net is trying to fix the picture with origin lines, which may make awful pattens.
Here is an example:
Line art
Low resolution output
Highres, just notice these strange red lines in the sky

I think a button on the UI disabling control net in highres can help to fix this problem.
Related: #62
I got a solution. My code is ugly, but I guess it's working.
Add a checkbox

My method need to modify 2 files, one is ./extensions/sd-webui-controlnet/scripts/controlnet.py And another, is ./modules/processing.py
The first has been uploaded to my repo: https://github.com/105gun/sd-webui-controlnet/blob/Highres-disable/scripts/controlnet.py
While in processing.py, we just call disable_controlnet() in StableDiffusionProcessingTxt2Img/sample/save_intermediate(). This function will be called before Highres.fix.
# highres hack
sys.path.append('./extensions/sd-webui-controlnet')
from scripts.controlnet import disable_controlnet
sys.path.remove('./extensions/sd-webui-controlnet')
disable_controlnet()
# highres hack end

I don't know if there is any way to implement similar function without modifying processing.py.
Added a trick to improve quality when hires enabled. https://github.com/Mikubill/sd-webui-controlnet/blob/c2eff2c56fa46f5cbcaf827eeddbe1fd2dc65792/scripts/cldm.py#L73-L80 Image generated using your sketch:
| Completely Disabled | Only Mid-Control | Based |
|---|---|---|
![]() |
![]() |
![]() |
When I'm using Hi-res and the Hi-res upscale value is not precisely 1.5, 1.75, 2.0, etc... I'm getting this: RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 28 but got size 27 for tensor number 1 in the list.
When I'm using Hi-res and the Hi-res upscale value is not precisely 1.5, 1.75, 2.0, etc... I'm getting this:
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 28 but got size 27 for tensor number 1 in the list.
Same thing happening.
I get a tensor size error any time I have ControlNet enabled and High-res fix on, even if it is exactly 1.5 etc.
Hi. This trick no longer works. Leads to an error. Is there a new solution?


