Mikubill / sd-webui-controlnet

WebUI extension for ControlNet
GNU General Public License v3.0
17.09k stars 1.96k forks source link

[Bug]: controlnet API doesn't work #1758

Closed LX-Jimmy closed 1 year ago

LX-Jimmy commented 1 year ago

Is there an existing issue for this?

What happened?

I tried to use controlnet web API to generate image. The API URL is /sdapi/v1/img2img, I can successfully generate image without controlnet, but accroding to https://github.com/Mikubill/sd-webui-controlnet/wiki/API#migrating-from-controlnet2img-to-sdapiv12img, when I added:

"alwayson_scripts": { "controlnet": { "args": [ { "module": "canny", "model": "control_canny-fp16 [e3fe7712]" } ] } }

it seems that the img2img run fine but the controlnet model doesn't kick in

I have searched for this problem, I see this problems occured in March when the sd and controlnet updated. The link is: https://github.com/Mikubill/sd-webui-controlnet/issues/571

I also tried to post an array as previous solutions told us to do, it was still useless

My post body is: { "denoising_strength": 1, "maskblur": 4, "prompt": "halo, paimon(genshin_impact), 1girl, simple_background, open_mouth, white_background, sparkle, solo, monochrome", "seed": 3974759810, "sampler_name": "Euler a", "steps": 50, "cfg_scale": 7, "width": 1024, "height": 1024, "alwayson_scripts": { "ControlNet": { "args": [ "module": "canny", "model": "control_canny-fp16 [e3fe7712]" ] } } "init_images": [encoded image] }

I have also tried to add "input_image" to controlnet, it was also useless

Steps to reproduce the problem

  1. Call API /controlnet/img2img with provided JSON body
  2. Wait for result

What should have happened?

it should get result processed by controlnet

Commit where the problem happens

None

What browsers do you use to access the UI ?

No response

Command Line Arguments

Microsoft Edge

List of enabled extensions

None

Console logs

{

    "images": [encoded image]

    "parameters": {

        "init_images": null,

        "resize_mode": 0,

        "denoising_strength": 1.0,

        "image_cfg_scale": null,

        "mask": null,

        "mask_blur": 4,

        "inpainting_fill": 0,

        "inpaint_full_res": true,

        "inpaint_full_res_padding": 0,

        "inpainting_mask_invert": 0,

        "initial_noise_multiplier": null,

        "prompt": "halo, paimon_(genshin_impact), 1girl, simple_background, open_mouth, white_background, sparkle, solo, monochrome",

        "styles": null,

        "seed": 3974759810,

        "subseed": -1,

        "subseed_strength": 0,

        "seed_resize_from_h": -1,

        "seed_resize_from_w": -1,

        "sampler_name": "Euler a",

        "batch_size": 1,

        "n_iter": 1,

        "steps": 50,

        "cfg_scale": 7.0,

        "width": 512,

        "height": 512,

        "restore_faces": false,

        "tiling": false,

        "negative_prompt": null,

        "eta": null,

        "s_churn": 0.0,

        "s_tmax": null,

        "s_tmin": 0.0,

        "s_noise": 1.0,

        "override_settings": null,

        "override_settings_restore_afterwards": true,

        "script_args": [],

        "sampler_index": "Euler",

        "include_init_images": false,

        "script_name": null

    },

    "info": "{\"prompt\": \"halo, paimon_(genshin_impact), 1girl, simple_background, open_mouth, white_background, sparkle, solo, monochrome\", \"all_prompts\": [\"halo, paimon_(genshin_impact), 1girl, simple_background, open_mouth, white_background, sparkle, solo, monochrome\"], \"negative_prompt\": \"\", \"all_negative_prompts\": [\"\"], \"seed\": 3974759810, \"all_seeds\": [3974759810], \"subseed\": 277290073, \"all_subseeds\": [277290073], \"subseed_strength\": 0, \"width\": 512, \"height\": 512, \"sampler_name\": \"Euler a\", \"cfg_scale\": 7.0, \"steps\": 50, \"batch_size\": 1, \"restore_faces\": false, \"face_restoration_model\": null, \"sd_model_hash\": \"a1535d0a42\", \"seed_resize_from_w\": -1, \"seed_resize_from_h\": -1, \"denoising_strength\": 1.0, \"extra_generation_params\": {}, \"index_of_first_image\": 0, \"infotexts\": [\"halo, paimon_(genshin_impact), 1girl, simple_background, open_mouth, white_background, sparkle, solo, monochrome\\nSteps: 50, Sampler: Euler a, CFG scale: 7.0, Seed: 3974759810, Size: 512x512, Model hash: a1535d0a42, Model: AnythingV5Ink_v32Ink, Seed resize from: -1x-1, Denoising strength: 1.0, Clip skip: 2, ENSD: 31337\"], \"styles\": [], \"job_timestamp\": \"20230704184325\", \"clip_skip\": 2, \"is_using_inpainting_conditioning\": false}"

}

Additional information

No response

huchenlei commented 1 year ago

You can try this extension: https://github.com/huchenlei/sd-webui-api-payload-display .

it will display the api payload after you do a generation in webui.

LX-Jimmy commented 1 year ago

You can try this extension: https://github.com/huchenlei/sd-webui-api-payload-display .

it will display the api payload after you do a generation in webui.

it is super helpful. And I found my problem was just sd version issue. When I have updated sd to latest one, terminal still used an old one.

ChenCheng2Cs commented 1 year ago

You can try this extension: https://github.com/huchenlei/sd-webui-api-payload-display .

it will display the api payload after you do a generation in webui.

I install your extension but nothing is shown. It will be better if you can provide some useful guides. Thanks!

huchenlei commented 1 year ago

It only shows payload after you generate something.

akorchemniy commented 1 year ago

It sounds like the documentation is out of date for the API. So what is the fix? The suggestion extension is now broken.