Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controlnet not work in inpainting task? #44

Open
crazySyaoran opened this issue Apr 4, 2023 · 2 comments
Open

controlnet not work in inpainting task? #44

crazySyaoran opened this issue Apr 4, 2023 · 2 comments

Comments

@crazySyaoran
Copy link

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]
                      )
@crazySyaoran
Copy link
Author

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?

@JinShiyin
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants