huchenlei / sd-webui-api-payload-display

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

Drop unsupported args in ControlNet unit payload #13

Open huchenlei opened 7 months ago

huchenlei commented 7 months ago

The ControlNet unit dumped by the extension are UiControlNetUnit instances, which contain a few extra parameters that are either not supported or not supposed to be used in API.

We should drop them so that they do not cause confusion.

These parameters include:

 is_ui: boolean;
 input_mode: number;
 batch_images: Array;
 output_dir: string;
 loopback: boolean;
ZhuBoao commented 4 months ago

I am wonderrin is the payload in alwayson_scripts -> ControlNet actually working? I have this following json copied from the ui

{
    "alwayson_scripts": {
        "API payload": {
            "args": []
        },
        "ControlNet": {
            "args": [
                {
                    "advanced_weighting": null,
                    "batch_images": "",
                    "control_mode": "Balanced",
                    "enabled": true,
                    "guidance_end": 1,
                    "guidance_start": 0,
                    "hr_option": "Both",
                    "image": {
                        "image": "base64image placeholder",
                        "mask": "base64image placeholder"
                    },
                    "inpaint_crop_input_image": false,
                    "input_mode": "simple",
                    "is_ui": true,
                    "loopback": false,
                    "low_vram": false,
                    "model": "ip-adapter-faceid-plusv2_sd15 [6e14fc1a]",
                    "module": "ip-adapter_face_id_plus",
                    "output_dir": "",
                    "pixel_perfect": false,
                    "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
                },
                {
                    "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
            ]
        },
        "Regional Prompter": {
            "args": [
                false,
                false,
                "Matrix",
                "Columns",
                "Mask",
                "Prompt",
                "1,1",
                "0.2",
                false,
                false,
                false,
                "Attention",
                [
                    false
                ],
                "0",
                "0",
                "0.4",
                null,
                "0",
                "0",
                false
            ]
        },
        "Seed": {
            "args": [
                -1,
                false,
                -1,
                0,
                0,
                0
            ]
        }
    },
    "batch_size": 1,
    "cfg_scale": 7,
    "comments": {},
    "disable_extra_networks": false,
    "do_not_save_grid": false,
    "do_not_save_samples": false,
    "enable_hr": false,
    "height": 512,
    "hr_negative_prompt": "",
    "hr_prompt": "",
    "hr_resize_x": 0,
    "hr_resize_y": 0,
    "hr_scale": 2,
    "hr_second_pass_steps": 0,
    "hr_upscaler": "Latent",
    "n_iter": 1,
    "negative_prompt": "disfigure, deformed, ugly",
    "override_settings": {},
    "override_settings_restore_afterwards": true,
    "prompt": "A woman in office, white professional shirt <lora:ip-adapter-faceid-plusv2_sd15_lora:1>",
    "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": -1,
    "seed_enable_extras": true,
    "seed_resize_from_h": -1,
    "seed_resize_from_w": -1,
    "steps": 20,
    "styles": [],
    "subseed": -1,
    "subseed_strength": 0,
    "tiling": false,
    "width": 512
}

But even if I paste the encoded base64 image to base64image placeholder, the response still seems to be not applying ControlNet. Is something wrong on my side?

--------------------update ---------------------------------------- Guess I've found the issue instead of "image": { "image": "base64image placeholder", "mask": "base64image placeholder" } I directly put base64 image to the first level image object. "image": ”base64image“

and got correct response from API.

Is it a potential bug? @huchenlei I suppose the copied json should be the correct format

Thank you for the great work on this extension btw. Really helpful!

huchenlei commented 4 months ago

Wield. In sd-webui-controlnet, both should work. In SD Forge,

"image": {
"image": "base64image placeholder",
"mask": "base64image placeholder"
}

probably won't work. Can you confirm which UI you are using?

ZhuBoao commented 4 months ago

Wield. In sd-webui-controlnet, both should work. In SD Forge,

"image": {
"image": "base64image placeholder",
"mask": "base64image placeholder"
}

probably won't work. Can you confirm which UI you are using?

I am using the latest automatic1111 on Window 11, with sd-webui-controlnet extension installed

YuxuanWang0822 commented 1 month ago

Hi, same problem, did you solve it?

Wield. In sd-webui-controlnet, both should work. In SD Forge,

"image": {
"image": "base64image placeholder",
"mask": "base64image placeholder"
}

probably won't work. Can you confirm which UI you are using?

I am using the latest automatic1111 on Window 11, with sd-webui-controlnet extension installed