huchenlei / sd-webui-api-payload-display

Display the corresponding API payload after each generation on WebUI
MIT License
179 stars 18 forks source link

ValueError: controlnet is enabled but no input image is given #17

Open MaggieLxj opened 5 months ago

MaggieLxj commented 5 months ago

It seems that controlnet batch_images dir not work. My api payload looked like as follow: { "alwayson_scripts": { "API payload": { "args": [] }, "Comments": { "args": [] }, "ControlNet": { "args": [ { "advanced_weighting": null, "batch_images": "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/images-prac", "control_mode": "Balanced", "enabled": true, "guidance_end": 1, "guidance_start": 0, "hr_option": "Both", "image": null, "inpaint_crop_input_image": false, "input_mode": "batch", "is_ui": true, "loopback": false, "low_vram": false, "model": "control_v11p_sd15_lineart [43d4be0d]", "module": "lineart_realistic", "output_dir": "", "pixel_perfect": true, "processor_res": 512, "resize_mode": "Crop and Resize", "save_detected_map": true, "threshold_a": -1, "threshold_b": -1, "weight": 1.1 }, { "advanced_weighting": null, "batch_images": "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/images-prac", "control_mode": "Balanced", "enabled": true, "guidance_end": 1, "guidance_start": 0, "hr_option": "Both", "image": null, "inpaint_crop_input_image": false, "input_mode": "batch", "is_ui": true, "loopback": false, "low_vram": false, "model": "control_v11p_sd15_seg [e1f51eb9]", "module": "seg_ofade20k", "output_dir": "", "pixel_perfect": true, "processor_res": 512, "resize_mode": "Crop and Resize", "save_detected_map": true, "threshold_a": -1, "threshold_b": -1, "weight": 1 }, { "advanced_weighting": null, "batch_images": "", "control_mode": "Balanced", "enabled": false, "guidance_end": 1, "guidance_start": 0, "hr_option": "Both", "image": null, "inpaint_crop_input_image": false, "input_mode": "simple", "is_ui": true, "loopback": false, "low_vram": false, "model": "None", "module": "none", "output_dir": "", "pixel_perfect": false, "processor_res": -1, "resize_mode": "Crop and Resize", "save_detected_map": true, "threshold_a": -1, "threshold_b": -1, "weight": 1 } ] }, "Extra options": { "args": [] }, "Hypertile": { "args": [] }, "Refiner": { "args": [ false, "", 0.8 ] }, "Seed": { "args": [ 1739178872, 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 ] }, "Tiled Diffusion": { "args": [ false, "MultiDiffusion", false, true, 1024, 1024, 96, 96, 48, 4, "None", 2, false, 10, 1, 1, 64, false, false, false, false, false, 0.4, 0.4, 0.2, 0.2, "", "", "Background", 0.2, -1.0, false, 0.4, 0.4, 0.2, 0.2, "", "", "Background", 0.2, -1.0, false, 0.4, 0.4, 0.2, 0.2, "", "", "Background", 0.2, -1.0, false, 0.4, 0.4, 0.2, 0.2, "", "", "Background", 0.2, -1.0, false, 0.4, 0.4, 0.2, 0.2, "", "", "Background", 0.2, -1.0, false, 0.4, 0.4, 0.2, 0.2, "", "", "Background", 0.2, -1.0, false, 0.4, 0.4, 0.2, 0.2, "", "", "Background", 0.2, -1.0, false, 0.4, 0.4, 0.2, 0.2, "", "", "Background", 0.2, -1.0 ] }, "Tiled VAE": { "args": [ false, 3072, 192, true, true, true, false ] }, "demofusion": { "args": [ false, "DemoFusion", false, 128, 64, 4, 2, false, 10, 1, 1, 64, false, true, 3, 1, 1, true, 0.85, 0.6, 4, false ] } }, "batch_size": 1, "cfg_scale": 7, "comments": {}, "denoising_strength": 0.7, "disable_extra_networks": false, "do_not_save_grid": true, "do_not_save_samples": false, "enable_hr": true, "height": 540, "hr_negative_prompt": "(text:1.2), sun, wired_shapes_cars, overhead_view, distortion_shapes, bad_anatomy, error, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry,(drawing:1.1), (painting:1.1), virtual", "hr_prompt": "cars driving on the road, (rainy:1.2), tree, detailed_cars break sky break people break street break road_sign break white_lanes break traffic_light, random scenery, (highly detailed), (high fidelity), masterpiece, best quality, realistic, high quality", "hr_resize_x": 0, "hr_resize_y": 0, "hr_scale": 2, "hr_second_pass_steps": 0, "hr_upscaler": "ESRGAN_4x", "n_iter": 1, "negative_prompt": "(text:1.2), sun, wired_shapes_cars, overhead_view, distortion_shapes, bad_anatomy, error, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry,(drawing:1.1), (painting:1.1), virtual", "override_settings": {}, "override_settings_restore_afterwards": true, "prompt": "cars driving on the road, (rainy:1.2), tree, detailed_cars break sky break people break street break road_sign break white_lanes break traffic_light, random scenery, (highly detailed), (high fidelity), masterpiece, best quality, realistic, high quality", "restore_faces": false, "s_churn": 0.0, "s_min_uncond": 0.0, "s_noise": 1.0, "s_tmax": null, "s_tmin": 0.0, "sampler_name": "DPM++ 2M Karras", "script_args": [], "script_name": null, "seed": 1739178872, "seed_enable_extras": true, "seed_resize_from_h": -1, "seed_resize_from_w": -1, "steps": 20, "styles": [], "subseed": 2841292808, "subseed_strength": 0, "tiling": false, "width": 960 }

MaggieLxj commented 5 months ago

Error log looks like as below.

** Error running process: /home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py Traceback (most recent call last): File "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/modules/scripts.py", line 784, in process script.process(p, script_args) File "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 1117, in process self.controlnet_hack(p) File "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 1102, in controlnet_hack self.controlnet_main_entry(p) File "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 896, in controlnet_main_entry input_image, resize_mode = Script.choose_input_image(p, unit, idx) File "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 673, in choose_input_image raise ValueError("controlnet is enabled but no input image is given") ValueError: controlnet is enabled but no input image is given

MaggieLxj commented 5 months ago

When I use another json params to test sd-webui --nowebui, error happened again. Error log like this. *** Error running process: /home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py Traceback (most recent call last): File "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/modules/api/api.py", line 96, in decode_base64_to_image image = Image.open(BytesIO(base64.b64decode(encoding))) File "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/venv/lib/python3.10/site-packages/PIL/Image.py", line 3298, in open raise UnidentifiedImageError(msg) PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7fb05d0dd670>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/modules/scripts.py", line 784, in process
    script.process(p, *script_args)
  File "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 1117, in process
    self.controlnet_hack(p)
  File "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 1102, in controlnet_hack
    self.controlnet_main_entry(p)
  File "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 896, in controlnet_main_entry
    input_image, resize_mode = Script.choose_input_image(p, unit, idx)
  File "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 606, in choose_input_image
    image = parse_unit_image(unit)
  File "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 593, in parse_unit_image
    return image_dict_from_any(unit.image)
  File "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 106, in image_dict_from_any
    image['image'] = external_code.to_base64_nparray(image['image'])
  File "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/extensions/sd-webui-controlnet/internal_controlnet/external_code.py", line 212, in to_base64_nparray
    return np.array(api.decode_base64_to_image(encoding)).astype('uint8')
  File "/home/lxj/Documents/code/ScenarioTool/stable-diffusion-webui/modules/api/api.py", line 99, in decode_base64_to_image
    raise HTTPException(status_code=500, detail="Invalid encoded image") from e
fastapi.exceptions.HTTPException

The json params like this. { "alwayson_scripts": { "controlnet": { "args": [ { "control_mode": 0, "enabled": True, "guidance_end": 0.5, "guidance_start": 0.0, "input_image": "base64SrcImg", "lowvram": False, "model": "control_v11p_sd15_softedge [a8575a2a]", "module": "softedge_pidinet", "pixel_perfect": True, "processor_res": 0, "resize_mode": 1, "threshold_a": 0, "threshold_b": 0, "weight": 0.3 }, { "control_mode": 0, "enabled": True, "guidance_end": 0.5, "guidance_start": 0.0, "input_image": "base64SrcImg", "lowvram": False, "model": "control_v11f1p_sd15_depth [cfd03158]", "module": "depth_midas", "pixel_perfect": True, "processor_res": 0, "resize_mode": 1, "threshold_a": 0, "threshold_b": 0, "weight": 0.75 } ] } }, "batch_size": 4, "cfg_scale": 7, "height": 512, "negative_prompt": "EasyNegative, paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans,extra fingers,fewer fingers,strange fingers,bad hand,backlight, (worst quality, low quality:1.4), watermark, logo, bad anatomy,lace,rabbit,back,", "override_settings": { "sd_model_checkpoint": "chosenMix_chosenMix.ckpt [dd0aacadb6]", "sd_vae": "pastel-waifu-diffusion.vae.pt" }, "clip_skip": 2, "prompt": ",(best quality:1.25),( masterpiece:1.25), (ultra high res:1.25), (no human:1.3),,(white background:2)", "restore_faces": False, "sampler_index": "DPM++ SDE Karras", "sampler_name": "", "script_args": [ ], "seed": -1, "steps": 28, "tiling": False, "width": 512 }