stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: Missing script initializations in --nowebui mode

Open bigahega opened this issue 2 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

ControlNet extension (https://github.com/Mikubill/sd-webui-controlnet) defines its own API endpoints for txt2img and img2img (/controlnet/txt2img and /controlnet/img2img respectively) and when webui is launched with the --nowebui --api flags, it only calls ScriptRunner.initialize_scripts() if /sdapi/v1/txt2img or /sdapi/v1/img2img endpoints are called.

Therefore, if you launch the webui with --nowebui --api flags and call the controlnet api through their own endpoints, the controlnet script is not processed in the pipeline since it has never been initialized. However, if you somehow let the webui to initialize scripts, the controlnet script is processed properly via their own endpoints.

Steps to reproduce the problem

  1. Install the https://github.com/Mikubill/sd-webui-controlnet extension, add required models.
  2. Launch webui with --nowebui --api
  3. Call /controlnet/txt2img or /controlnet/img2img
  4. Controlnet script is not processed in the pipeline and pure txt2img or img2img results are returned

What should have happened?

Controlnet script should had been initialized and later on have been processed in the pipeline properly

Commit where the problem happens

Latest (0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8)

What platforms do you use to access the UI ?

No response

What browsers do you use to access the UI ?

No response

Command Line Arguments

--nowebui --api

List of extensions

controlnet https://github.com/Mikubill/sd-webui-controlnet

Console logs

-

Additional information

in api only mode scripts are initialized here: https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/modules/api/api.py#L170-L172 when/sdapi/v1/txt2img or /sdapi/v1/img2img is called with a script_name arg. However, controlnet defines its own endpoints so this code is never called and scripts are never initialized.

bigahega avatar Feb 22 '23 10:02 bigahega

Should be fixed in recent update to the controlnet extension API routes. Could you try it again?

ljleb avatar Feb 28 '23 20:02 ljleb