sdwebuiapi
sdwebuiapi copied to clipboard
controlnet not work in inpainting task?
I'm trying to use controlnet in the img2img-inpainting task:
unit1 = webuiapi.ControlNetUnit(input_image=img, module='depth', model='control_sd15_depth [fef5e48e]')
result2 = api.img2img(images=[img],
prompt="PHOTOREALISTIC, DREAMLIKEART, Masterpiece, best quality, 1 man, closeup of face, <lora:syaoran:1>, 1boy",
mask_image=Image.open("examples/ori_img/mask/FsYgWtCXsAIG1zH.png"),
steps=25,
# seed=5555,
cfg_scale=6.5,
width=680,
height=680,
denoising_strength=0.6,
controlnet_units=[unit1]
)
result2.image.save("output.png")
But seems not wok, and the automatic1111 complains:
Error running process: D:\playground\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\controlnet.py
Traceback (most recent call last):
File "D:\playground\stable-diffusion-webui\modules\scripts.py", line 417, in process
script.process(p, *script_args)
File "D:\playground\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\controlnet.py", line 624, in process
unit = self.parse_remote_call(p, unit, idx)
File "D:\playground\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\controlnet.py", line 536, in parse_remote_call
unit.enabled = selector(p, "control_net_enabled", unit.enabled, idx, strict=True)
AttributeError: 'str' object has no attribute 'enabled'
By the way, if i dont use the controlnet_units
, everything works fine:
result2 = api.img2img(images=[img],
prompt="PHOTOREALISTIC, DREAMLIKEART, Masterpiece, best quality, 1 man, closeup of face, <lora:syaoran:1>, 1boy",
mask_image=Image.open("examples/ori_img/mask/FsYgWtCXsAIG1zH.png"),
steps=25,
# seed=5555,
cfg_scale=6.5,
width=680,
height=680,
denoising_strength=0.6,
#controlnet_units=[unit1]
)
Seems that it is caused by the version mismatch between sdwebuiapi and automatic1111. Could you tell me which version of automatic1111 you are using please?
just try to check the max num of controlnets you set in webui, and set the same num of controlnet units when call the api