AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
139.93k stars 26.51k forks source link

[Bug]: Api error for plugins #9013

Open wilzamguerrero opened 1 year ago

wilzamguerrero commented 1 year ago

Is there an existing issue for this?

What happened?

when i use pluhin for connect with sd i have and error from api, maybe i can use some lines of code for solve this?

Steps to reproduce the problem

when i used the plugin in photoshop

What should have happened?

connect with the plugin without error

Commit where the problem happens

api

What platforms do you use to access the UI ?

Other/Cloud

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

share = "--share --api --xformers --theme=dark --disable-safe-unpickle --enable-insecure-extension-access --no-half-vae

List of extensions

none

Console logs

Preparing SDZ Continue ✓
Preparing SDZ System ✓
https://plain-jokes-go-35-185-242-52.loca.lt
Python 3.9.16 (main, Dec  7 2022, 01:11:51) 
[GCC 9.4.0]
Commit hash: 4c1ad743e3baf1246db0711aa0107debf036a12b
Installing requirements for Web UI

Fetching updates for midas...
Checking out commit for midas with hash: b845b78...

Launching Web UI with arguments: --share --api --xformers --theme=dark --disable-safe-unpickle --enable-insecure-extension-access --no-half-vae --cors-allow-origins=https://www.painthua.com,https://zero01101.github.io --ckpt= --ckpt-dir=
Checkpoint in --ckpt argument not found (Possible it was moved to /content/stable-diffusion-webui/models/Stable-diffusion: 
Checkpoint v1-5-fp16.ckpt [a2a802b2] not found; loading fallback content/stable-diffusion-webui/models/Stable-diffusion/15Deliberate_2.safetensors [9aba26abdf]
Loading weights [9aba26abdf] from /content/stable-diffusion-webui/models/Stable-diffusion/15Deliberate_2.safetensors
Creating model from config: /content/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(2): bad-hands-5, easynegative
Model loaded in 20.7s (load weights from disk: 13.6s, create model: 1.4s, apply weights to model: 3.6s, apply half(): 1.3s, move model to device: 0.7s).
Running on local URL:  http://127.0.0.1:7860
Running on public URL: https://4ad0b41c18a85d1df5.gradio.live

Startup time: 37.7s (import torch: 6.6s, import gradio: 1.4s, import ldm: 0.3s, other imports: 1.4s, list extensions: 1.1s, setup codeformer: 0.2s, load scripts: 3.0s, load SD checkpoint: 20.7s, create ui: 1.5s, gradio launch: 1.3s).
API error: GET: https://4ad0b41c18a85d1df5.gradio.live/sdapi/v1/options {'error': 'ValidationError', 'detail': '', 'body': '', 'errors': '1 validation error for Options\nresponse -> sd_checkpoint_hash\n  value is not None (type=type_error.not_none)'}
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /usr/local/lib/python3.9/dist-packages/anyio/streams/memory.py:94 in receive │
│                                                                              │
│ /usr/local/lib/python3.9/dist-packages/anyio/streams/memory.py:89 in         │
│ receive_nowait                                                               │
╰──────────────────────────────────────────────────────────────────────────────╯
WouldBlock

During handling of the above exception, another exception occurred:

╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /usr/local/lib/python3.9/dist-packages/starlette/middleware/base.py:78 in    │
│ call_next                                                                    │
│                                                                              │
│ /usr/local/lib/python3.9/dist-packages/anyio/streams/memory.py:114 in        │
│ receive                                                                      │
╰──────────────────────────────────────────────────────────────────────────────╯
EndOfStream

During handling of the above exception, another exception occurred:

╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /content/stable-diffusion-webui/modules/api/api.py:144 in exception_handling │
│                                                                              │
│   143 │   │   try:                                                           │
│ ❱ 144 │   │   │   return await call_next(request)                            │
│   145 │   │   except Exception as e:                                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │        call_next = <function                                             │ │
│ │                    BaseHTTPMiddleware.__call__.<locals>.call_next at     │ │
│ │                    0x7f13a2907670>                                       │ │
│ │                e = ValidationError(                                      │ │
│ │                    │   model='Options',                                  │ │
│ │                    │   errors=[                                          │ │
│ │                    │   │   {                                             │ │
│ │                    │   │   │   'loc': (                                  │ │
│ │                    │   │   │   │   'response',                           │ │
│ │                    │   │   │   │   'sd_checkpoint_hash'                  │ │
│ │                    │   │   │   ),                                        │ │
│ │                    │   │   │   'msg': 'value is not None',               │ │
│ │                    │   │   │   'type': 'type_error.not_none'             │ │
│ │                    │   │   }                                             │ │
│ │                    │   ]                                                 │ │
│ │                    )                                                     │ │
│ │ handle_exception = <function api_middleware.<locals>.handle_exception at │ │
│ │                    0x7f13a2a4fd30>                                       │ │
│ │          request = <starlette.requests.Request object at 0x7f13a2918af0> │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.9/dist-packages/starlette/middleware/base.py:84 in    │
│ call_next                                                                    │
│                                                                              │
│                           ... 15 frames hidden ...                           │
│                                                                              │
│ /usr/local/lib/python3.9/dist-packages/fastapi/routing.py:255 in app         │
│                                                                              │
│    254 │   │   │   │   response_args["status_code"] = sub_response.status_co │
│ ❱  255 │   │   │   content = await serialize_response(                       │
│    256 │   │   │   │   field=response_field,                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │                               _ = {}                                     │ │
│ │           actual_response_class = <class 'gradio.routes.ORJSONResponse'> │ │
│ │                background_tasks = None                                   │ │
│ │                            body = None                                   │ │
│ │                      body_field = None                                   │ │
│ │             current_status_code = None                                   │ │
│ │                       dependant = <fastapi.dependencies.models.Dependant │ │
│ │                                   object at 0x7f13a2adcb20>              │ │
│ │   dependency_overrides_provider = <gradio.routes.App object at           │ │
│ │                                   0x7f13a257b490>                        │ │
│ │                          errors = []                                     │ │
│ │                    is_body_form = None                                   │ │
│ │                    is_coroutine = False                                  │ │
│ │                    raw_response = {                                      │ │
│ │                                   │   'samples_save': True,              │ │
│ │                                   │   'samples_format': 'png',           │ │
│ │                                   │   'samples_filename_pattern': '',    │ │
│ │                                   │   'save_images_add_number': True,    │ │
│ │                                   │   'grid_save': True,                 │ │
│ │                                   │   'grid_format': 'png',              │ │
│ │                                   │   'grid_extended_filename': False,   │ │
│ │                                   │   'grid_only_if_multiple': True,     │ │
│ │                                   │   'grid_prevent_empty_spots': False, │ │
│ │                                   │   'n_rows': -1,                      │ │
│ │                                   │   ... +100                           │ │
│ │                                   }                                      │ │
│ │                         request = <starlette.requests.Request object at  │ │
│ │                                   0x7f13a2920700>                        │ │
│ │                   response_args = {'background': None}                   │ │
│ │                  response_field = ModelField(                            │ │
│ │                                   │                                      │ │
│ │                                   name='Response_get_config_sdapi_v1_op… │ │
│ │                                   │   type=Options,                      │ │
│ │                                   │   required=True                      │ │
│ │                                   )                                      │ │
│ │         response_model_by_alias = True                                   │ │
│ │          response_model_exclude = None                                   │ │
│ │ response_model_exclude_defaults = False                                  │ │
│ │     response_model_exclude_none = False                                  │ │
│ │    response_model_exclude_unset = False                                  │ │
│ │          response_model_include = None                                   │ │
│ │                   solved_result = (                                      │ │
│ │                                   │   {},                                │ │
│ │                                   │   [],                                │ │
│ │                                   │   None,                              │ │
│ │                                   │   <starlette.responses.Response      │ │
│ │                                   object at 0x7f13a2920730>,             │ │
│ │                                   │   {}                                 │ │
│ │                                   )                                      │ │
│ │                     status_code = None                                   │ │
│ │                    sub_response = <starlette.responses.Response object   │ │
│ │                                   at 0x7f13a2920730>                     │ │
│ │                          values = {}                                     │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.9/dist-packages/fastapi/routing.py:141 in             │
│ serialize_response                                                           │
│                                                                              │
│    140 │   │   if errors:                                                    │
│ ❱  141 │   │   │   raise ValidationError(errors, field.type_)                │
│    142 │   │   return jsonable_encoder(                                      │
│                                                                              │
│ ╭──────────────────────────────── locals ─────────────────────────────────╮  │
│ │         by_alias = True                                                 │  │
│ │           errors = [                                                    │  │
│ │                    │   ErrorWrapper(                                    │  │
│ │                    │   │   exc=ValidationError(                         │  │
│ │                    │   │   │   model='Options',                         │  │
│ │                    │   │   │   errors=[                                 │  │
│ │                    │   │   │   │   {                                    │  │
│ │                    │   │   │   │   │   'loc': ('sd_checkpoint_hash',),  │  │
│ │                    │   │   │   │   │   'msg': 'value is not None',      │  │
│ │                    │   │   │   │   │   'type': 'type_error.not_none'    │  │
│ │                    │   │   │   │   }                                    │  │
│ │                    │   │   │   ]                                        │  │
│ │                    │   │   ),                                           │  │
│ │                    │   │   loc=('response',)                            │  │
│ │                    │   )                                                │  │
│ │                    ]                                                    │  │
│ │          errors_ = ErrorWrapper(                                        │  │
│ │                    │   exc=ValidationError(                             │  │
│ │                    │   │   model='Options',                             │  │
│ │                    │   │   errors=[                                     │  │
│ │                    │   │   │   {                                        │  │
│ │                    │   │   │   │   'loc': ('sd_checkpoint_hash',),      │  │
│ │                    │   │   │   │   'msg': 'value is not None',          │  │
│ │                    │   │   │   │   'type': 'type_error.not_none'        │  │
│ │                    │   │   │   }                                        │  │
│ │                    │   │   ]                                            │  │
│ │                    │   ),                                               │  │
│ │                    │   loc=('response',)                                │  │
│ │                    )                                                    │  │
│ │          exclude = None                                                 │  │
│ │ exclude_defaults = False                                                │  │
│ │     exclude_none = False                                                │  │
│ │    exclude_unset = False                                                │  │
│ │            field = ModelField(                                          │  │
│ │                    │   name='Response_get_config_sdapi_v1_options_get', │  │
│ │                    │   type=Options,                                    │  │
│ │                    │   required=True                                    │  │
│ │                    )                                                    │  │
│ │          include = None                                                 │  │
│ │     is_coroutine = False                                                │  │
│ │ response_content = {                                                    │  │
│ │                    │   'samples_save': True,                            │  │
│ │                    │   'samples_format': 'png',                         │  │
│ │                    │   'samples_filename_pattern': '',                  │  │
│ │                    │   'save_images_add_number': True,                  │  │
│ │                    │   'grid_save': True,                               │  │
│ │                    │   'grid_format': 'png',                            │  │
│ │                    │   'grid_extended_filename': False,                 │  │
│ │                    │   'grid_only_if_multiple': True,                   │  │
│ │                    │   'grid_prevent_empty_spots': False,               │  │
│ │                    │   'n_rows': -1,                                    │  │
│ │                    │   ... +100                                         │  │
│ │                    }                                                    │  │
│ │            value = {                                                    │  │
│ │                    │   'samples_save': True,                            │  │
│ │                    │   'samples_format': 'png',                         │  │
│ │                    │   'samples_filename_pattern': '',                  │  │
│ │                    │   'save_images_add_number': True,                  │  │
│ │                    │   'grid_save': True,                               │  │
│ │                    │   'grid_format': 'png',                            │  │
│ │                    │   'grid_extended_filename': False,                 │  │
│ │                    │   'grid_only_if_multiple': True,                   │  │
│ │                    │   'grid_prevent_empty_spots': False,               │  │
│ │                    │   'n_rows': -1,                                    │  │
│ │                    │   ... +100                                         │  │
│ │                    }                                                    │  │
│ ╰─────────────────────────────────────────────────────────────────────────╯  │
╰──────────────────────────────────────────────────────────────────────────────╯
ValidationError: 1 validation error for Options
response -> sd_checkpoint_hash
  value is not None (type=type_error.not_none)

Additional information

No response

xITmasterx commented 1 year ago

Same, I'm having this same error at the moment.

BahzBeih commented 1 year ago

same problem too in google colab notebook.

GitHub1712 commented 1 year ago

I believe this is on https only, should work on http localhost. Somthong is wrong with the api routes and https on latest commits. This also breakes all basic features(which are now using api routes) for me if running on https

simonmaris commented 1 year ago

same here, happened on https tunnel. Would also like to have some authentication, but that is another issue.

Amitg1 commented 1 year ago

same here. any suggestion on how to debug it?