lllyasviel / stable-diffusion-webui-forge

GNU Affero General Public License v3.0
8.65k stars 858 forks source link

[Bug]: API ControlNet is not working, Working in webui #627

Open roshanuser opened 8 months ago

roshanuser commented 8 months ago

Checklist

What happened?

ControlNet API is not working, but in webui ControlNet is working properly.

Steps to reproduce the problem

Go to http://127.0.0.1:7860/docs#/default/img2imgapi_sdapi_v1_img2img_post

{ "alwayson_scripts": { "API payload": { "args": [] }, "Comments": { "args": [] }, "ControlNet": { "args": [ { "batch_image_dir": "", "batch_input_gallery": [], "batch_mask_dir": "", "batch_mask_gallery": [], "control_mode": "Balanced", "enabled": true, "generated_image": null, "guidance_end": 1, "guidance_start": 0, "hr_option": "Both", "image": null, "input_mode": "simple", "mask_image": null, "model": "diffusion_pytorch_model [458b7f40]", "module": "openpose_full", "pixel_perfect": true, "processor_res": 512, "resize_mode": "Crop and Resize", "save_detected_map": true, "threshold_a": 0.5, "threshold_b": 0.5, "use_preview_as_input": false, "weight": 1 }, { "batch_image_dir": "", "batch_input_gallery": [], "batch_mask_dir": "", "batch_mask_gallery": [], "control_mode": "Balanced", "enabled": false, "generated_image": null, "guidance_end": 1, "guidance_start": 0, "hr_option": "Both", "image": null, "input_mode": "simple", "mask_image": null, "model": "None", "module": "None", "pixel_perfect": false, "processor_res": -1, "resize_mode": "Crop and Resize", "save_detected_map": true, "threshold_a": -1, "threshold_b": -1, "use_preview_as_input": false, "weight": 1 }, { "batch_image_dir": "", "batch_input_gallery": [], "batch_mask_dir": "", "batch_mask_gallery": [], "control_mode": "Balanced", "enabled": false, "generated_image": null, "guidance_end": 1, "guidance_start": 0, "hr_option": "Both", "image": null, "input_mode": "simple", "mask_image": null, "model": "None", "module": "None", "pixel_perfect": false, "processor_res": -1, "resize_mode": "Crop and Resize", "save_detected_map": true, "threshold_a": -1, "threshold_b": -1, "use_preview_as_input": false, "weight": 1 } ] }, "DynamicThresholding (CFG-Fix) Integrated": { "args": [ false, 7, 1, "Constant", 0, "Constant", 0, 1, "enable", "MEAN", "AD", 1 ] }, "Extra options": { "args": [] }, "FreeU Integrated": { "args": [ false, 1.01, 1.02, 0.99, 0.95 ] }, "HyperTile Integrated": { "args": [ false, 256, 2, 0, false ] }, "Kohya HRFix Integrated": { "args": [ false, 3, 2, 0, 0.35, true, "bicubic", "bicubic" ] }, "LatentModifier Integrated": { "args": [ false, 0, "anisotropic", 0, "reinhard", 100, 0, "subtract", 0, 0, "gaussian", "add", 0, 100, 127, 0, "hard_clamp", 5, 0, "None", "None" ] }, "MultiDiffusion Integrated": { "args": [ false, "MultiDiffusion", 768, 768, 64, 4 ] }, "Never OOM Integrated": { "args": [ false, false ] }, "Refiner": { "args": [ false, "", 0.8 ] }, "Seed": { "args": [ 1102242279, false, -1, 0, 0, 0 ] }, "Segment Anything": { "args": [ false, false, 0, null, [], 0, false, [], [], false, 0, 1, false, false, 0, null, [], -2, false, [], false, 0, null, null ] }, "SelfAttentionGuidance Integrated": { "args": [ false, 0.5, 2 ] }, "Soft Inpainting": { "args": [ false, 1, 0.5, 4, 0, 0.5, 2 ] }, "StyleAlign Integrated": { "args": [ false ] } }, "batch_size": 1, "cfg_scale": 7, "comments": {}, "denoising_strength": 0.75, "disable_extra_networks": false, "do_not_save_grid": false, "do_not_save_samples": false, "height": 683, "image_cfg_scale": 1.5, "init_images": [ "base64image placeholder" ], "initial_noise_multiplier": 1, "inpaint_full_res": 0, "inpaint_full_res_padding": 32, "inpainting_fill": 1, "inpainting_mask_invert": 0, "mask_blur": "base64image placeholder", "mask_blur": 4, "mask_blur_x": 4, "mask_blur_y": 4, "mask_round": true, "n_iter": 1, "negative_prompt": "ugly, deformed, noisy, blurry, distorted, nude, nsfw, out of focus, bad anatomy, extra limbs, poorly drawn face, poorly drawn hands, missing fingers, disfigured, ugly, bad, immature, cartoon, anime, 3d, painting, b&w", "override_settings": {}, "override_settings_restore_afterwards": true, "prompt": "group of people waring military costume, masterpiece hyper realism 8k, HDR, highly detailed, sharp focus, looking at the camera", "resize_mode": 0, "restore_faces": false, "s_churn": 0, "s_min_uncond": 0, "s_noise": 1, "s_tmax": null, "s_tmin": 0, "sampler_name": "Euler a", "script_args": [], "script_name": null, "seed": 1102242279, "seed_enable_extras": true, "seed_resize_from_h": -1, "seed_resize_from_w": -1, "steps": 30, "styles": [], "subseed": -1, "subseed_strength": 0, "tiling": false, "width": 1024 }

What should have happened?

ControlNet API is not working

What browsers do you use to access the UI ?

Google Chrome

Sysinfo

-

Console logs

ControlNet openpose is working fine with webui, but when I try from API same model and setting it is giving following error.

*** Error running postprocess_batch_list: D:\Forge\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.pys]
    Traceback (most recent call last):
      File "D:\Forge\webui\modules\scripts.py", line 859, in postprocess_batch_list
        script.postprocess_batch_list(p, pp, *script_args, **kwargs)
      File "D:\Forge\system\python\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "D:\Forge\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py", line 561, in postprocess_batch_list
        self.process_unit_after_every_sampling(p, unit, self.current_params[i], pp, *args, **kwargs)
    KeyError: 0

---
Total progress: 100%|██████████████████████████████████████████████████████████████████| 23/23 [00:05<00:00,  4.51it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 23/23 [00:05<00:00,  4.63it/s]

Additional information

-

jetjodh commented 7 months ago

@roshanuser Can you post the screenshot of settings in webui?

roshanuser commented 7 months ago

@roshanuser Can you post the screenshot of settings in webui? Yes Screenshot Capture - 2024-04-03 - 22-14-53 ControlNet settings Screenshot Capture - 2024-04-03 - 22-16-00

jetjodh commented 7 months ago

I meant the CN settings, with which you are able to generate the image.

roshanuser commented 7 months ago

I meant the CN settings, with which you are able to generate the image.

I am using inpaint upload Following are CN Settings

Screenshot Capture - 2024-04-03 - 22-45-34

Screenshot Capture - 2024-04-03 - 22-41-56

wolfnest commented 7 months ago

I meant the CN settings, with which you are able to generate the image.

It is work if you generate image with controlnet within forge-webui but if you use api. It just not work.

I got same error and still can't fix it

bank010 commented 4 months ago

Did you find a solution