Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Can't set "sd_vae" in override settings in txt2img api call #13841

Closed
1 task done
jetjodh opened this issue Nov 3, 2023 · 6 comments
Closed
1 task done

[Bug]: Can't set "sd_vae" in override settings in txt2img api call #13841

jetjodh opened this issue Nov 3, 2023 · 6 comments
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@jetjodh
Copy link

jetjodh commented Nov 3, 2023

Is there an existing issue for this?

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

What happened?

I am not able to set "sd_vae" in override settings payload in txt2img api call.

    Traceback (most recent call last):
      File "/stable-diffusion-webui/modules/api/api.py", line 187, in exception_handling
        return await call_next(request)
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/base.py", line 84, in call_next
        raise app_exc
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/base.py", line 70, in coro
        await self.app(scope, receive_or_disconnect, send_no_error)
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/base.py", line 108, in __call__
        response = await self.dispatch_func(request, call_next)
      File "/stable-diffusion-webui/modules/api/api.py", line 151, in log_and_time
        res: Response = await call_next(req)
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/base.py", line 84, in call_next
        raise app_exc
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/base.py", line 70, in coro
        await self.app(scope, receive_or_disconnect, send_no_error)
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/cors.py", line 84, in __call__
        await self.app(scope, receive, send)
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/gzip.py", line 24, in __call__
        await responder(scope, receive, send)
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/gzip.py", line 44, in __call__
        await self.app(scope, receive, self.send_with_gzip)
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 79, in __call__
        raise exc
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 68, in __call__
        await self.app(scope, receive, sender)
      File "/usr/local/lib/python3.10/dist-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
        raise e
      File "/usr/local/lib/python3.10/dist-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
        await self.app(scope, receive, send)
      File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 718, in __call__
        await route.handle(scope, receive, send)
      File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 276, in handle
        await self.app(scope, receive, send)
      File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 66, in app
        response = await func(request)
      File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 237, in app
        raw_response = await run_endpoint_function(
      File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 165, in run_endpoint_function
        return await run_in_threadpool(dependant.call, **values)
      File "/usr/local/lib/python3.10/dist-packages/starlette/concurrency.py", line 41, in run_in_threadpool
        return await anyio.to_thread.run_sync(func, *args)
      File "/usr/local/lib/python3.10/dist-packages/anyio/to_thread.py", line 33, in run_sync
        return await get_asynclib().run_sync_in_worker_thread(
      File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
        return await future
      File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 807, in run
        result = context.run(func, *args)
      File "/stable-diffusion-webui/modules/api/api.py", line 380, in text2imgapi
        processed = process_images(p)
      File "/stable-diffusion-webui/modules/processing.py", line 712, in process_images
        stored_opts = {k: opts.data[k] for k in p.override_settings.keys()}
      File "/stable-diffusion-webui/modules/processing.py", line 712, in <dictcomp>
        stored_opts = {k: opts.data[k] for k in p.override_settings.keys()}
    KeyError: 'sd_vae'

Steps to reproduce the problem

  1. Use this payload to call txt2img api endpoint (A1111 v1.6.0)
    {
    "prompt": "cinematic photo of an owl on a surfboard, beautiful, magnificent, painting",
    "steps": 20,
    "width": 512,
    "height": 512,
    "seed": 121212,
    "external_models": [],
    "override_settings": {
    "sd_model_checkpoint": "v1-5-pruned-emaonly.safetensors",
    "sd_vae": "sd-vae-ft-mse.safetensors"
    },
    "override_settings_restore_afterwards": true,
    }
  2. Get the error

What should have happened?

Should have set the VAE and generated an image.

Sysinfo

sysinfo-2023-11-03-16-16.txt

What browsers do you use to access the UI ?

No response

Console logs

Warning: BLIP not found at path /stable-diffusion-webui/repositories/BLIP/models/blip.py
face_yolov8n.pt: 100%|██████████| 6.21M/6.21M [00:00<00:00, 161MB/s]
face_yolov8s.pt: 100%|██████████| 22.5M/22.5M [00:00<00:00, 209MB/s]
hand_yolov8n.pt: 100%|██████████| 6.22M/6.22M [00:00<00:00, 257MB/s]
person_yolov8n-seg.pt: 100%|██████████| 6.75M/6.75M [00:00<00:00, 205MB/s]
person_yolov8s-seg.pt: 100%|██████████| 23.8M/23.8M [00:00<00:00, 329MB/s]
[-] ADetailer initialized. version: 23.7.11, num models: 9
2023-11-03 16:09:21,209 - ControlNet - INFO - ControlNet v1.1.415
ControlNet preprocessor location: /stable-diffusion-webui/extensions/sd-webui-controlnet/annotator/downloads
2023-11-03 16:09:21,509 - ControlNet - INFO - ControlNet v1.1.415
[sd-webui-freeu] Controlnet support: *enabled*
Checkpoint v1-5-pruned-emaonly.safetensors [6ce0161689] not found; loading fallback v1-5-pruned-emaonly.safetensors
Loading weights [None] from /stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Startup time: 12.7s (import torch: 4.0s, import gradio: 1.3s, setup paths: 1.6s, initialize shared: 1.1s, other imports: 0.9s, setup codeformer: 0.5s, load scripts: 3.1s, api.py: 0.2s).

Creating model from config: /stable-diffusion-webui/configs/v1-inference.yaml
(…)it-large-patch14/resolve/main/vocab.json: 100%|██████████| 961k/961k [00:00<00:00, 29.7MB/s]
(…)it-large-patch14/resolve/main/merges.txt: 100%|██████████| 525k/525k [00:00<00:00, 24.4MB/s]
(…)h14/resolve/main/special_tokens_map.json: 100%|██████████| 389/389 [00:00<00:00, 1.20MB/s]
(…)tch14/resolve/main/tokenizer_config.json: 100%|██████████| 905/905 [00:00<00:00, 3.53MB/s]
(…)t-large-patch14/resolve/main/config.json: 100%|██████████| 4.52k/4.52k [00:00<00:00, 14.2MB/s]
Applying attention optimization: xformers... done.

INFO:a1111:Calling POST /sdapi/v1/txt2img with params: {'prompt': 'cinematic photo of an owl on a surfboard, beautiful, magnificent, painting', 'full_prompt': 'cinematic photo of an owl on a surfboard, beautiful, magnificent, painting', 'steps': 20, 'width': 512, 'height': 512, 'seed': 121212, 'external_models': [], 'override_settings': {'sd_model_checkpoint': 'v1-5-pruned-emaonly.safetensors', 'sd_vae': 'sd-vae-ftw-mse.safetensors'}, 'override_settings_restore_afterwards': True, 'destination_uris': ['gs://images/test-id2'], 'api_name': 'txt2img'}
Calling automatic api
Init / preset error.
/stable-diffusion-webui/extensions/sd-webui-regional-prompter/scripts/rp.py:75: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  areasimg = gr.Image(type="pil", show_label  = False).style(height=256,width=256)
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
/stable-diffusion-webui/extensions/sd-webui-regional-prompter/scripts/rp.py:75: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  areasimg = gr.Image(type="pil", show_label  = False).style(height=256,width=256)
*** API error: POST: http://127.0.0.1:3003/sdapi/v1/txt2img {'error': 'KeyError', 'detail': '', 'body': '', 'errors': "'sd_vae'"}
    Traceback (most recent call last):
      File "/usr/local/lib/python3.10/dist-packages/anyio/streams/memory.py", line 98, in receive
        return self.receive_nowait()
      File "/usr/local/lib/python3.10/dist-packages/anyio/streams/memory.py", line 93, in receive_nowait
        raise WouldBlock
    anyio.WouldBlock

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/base.py", line 78, in call_next
        message = await recv_stream.receive()
      File "/usr/local/lib/python3.10/dist-packages/anyio/streams/memory.py", line 118, in receive
        raise EndOfStream
    anyio.EndOfStream

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/stable-diffusion-webui/modules/api/api.py", line 187, in exception_handling
        return await call_next(request)
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/base.py", line 84, in call_next
        raise app_exc
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/base.py", line 70, in coro
        await self.app(scope, receive_or_disconnect, send_no_error)
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/base.py", line 108, in __call__
        response = await self.dispatch_func(request, call_next)
      File "/stable-diffusion-webui/modules/api/api.py", line 151, in log_and_time
        res: Response = await call_next(req)
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/base.py", line 84, in call_next
        raise app_exc
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/base.py", line 70, in coro
        await self.app(scope, receive_or_disconnect, send_no_error)
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/cors.py", line 84, in __call__
        await self.app(scope, receive, send)
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/gzip.py", line 24, in __call__
        await responder(scope, receive, send)
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/gzip.py", line 44, in __call__
        await self.app(scope, receive, self.send_with_gzip)
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 79, in __call__
        raise exc
      File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 68, in __call__
        await self.app(scope, receive, sender)
      File "/usr/local/lib/python3.10/dist-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
        raise e
      File "/usr/local/lib/python3.10/dist-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
        await self.app(scope, receive, send)
      File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 718, in __call__
        await route.handle(scope, receive, send)
      File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 276, in handle
        await self.app(scope, receive, send)
      File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 66, in app
        response = await func(request)
      File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 237, in app
        raw_response = await run_endpoint_function(
      File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 165, in run_endpoint_function
        return await run_in_threadpool(dependant.call, **values)
      File "/usr/local/lib/python3.10/dist-packages/starlette/concurrency.py", line 41, in run_in_threadpool
        return await anyio.to_thread.run_sync(func, *args)
      File "/usr/local/lib/python3.10/dist-packages/anyio/to_thread.py", line 33, in run_sync
        return await get_asynclib().run_sync_in_worker_thread(
      File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
        return await future
      File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 807, in run
        result = context.run(func, *args)
      File "/stable-diffusion-webui/modules/api/api.py", line 380, in text2imgapi
        processed = process_images(p)
      File "/stable-diffusion-webui/modules/processing.py", line 712, in process_images
        stored_opts = {k: opts.data[k] for k in p.override_settings.keys()}
      File "/stable-diffusion-webui/modules/processing.py", line 712, in <dictcomp>
        stored_opts = {k: opts.data[k] for k in p.override_settings.keys()}
    KeyError: 'sd_vae'

---
INFO:     127.0.0.1:56626 - "POST /sdapi/v1/txt2img HTTP/1.1" 500 Internal Server Error
WARNING:a1111:A1111 error: {'error': 'KeyError', 'detail': '', 'body': '', 'errors': "'sd_vae'"}

Additional information

No response

@jetjodh jetjodh added the bug-report Report of a bug, yet to be confirmed label Nov 3, 2023
@joyoungzhang
Copy link

Please paste the contents of /stable-diffusion-webui/config.json

@catboxanon
Copy link
Collaborator

catboxanon commented Nov 8, 2023

Please paste the contents of /stable-diffusion-webui/config.json

The sysinfo posted by OP contains all of that.

That being said, have you ever saved your config in the settings tab @jetjodh? There may be an issue where it can't overwrite the value until the config has been saved.

@jetjodh
Copy link
Author

jetjodh commented Nov 8, 2023

@catboxanon I don't think so. I use the default settings out of the box. I don't use the UI from A1111, just the api calls with A1111 server.

@catboxanon
Copy link
Collaborator

I believe this is fixed in #13567 then (only on the dev branch currently).

@jetjodh
Copy link
Author

jetjodh commented Nov 8, 2023

Any idea on eta of how long it takes to get merged to main? Thanks.

@catboxanon
Copy link
Collaborator

Whenever 1.7.0 releases. Not any time soon I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Report of a bug, yet to be confirmed
Projects
None yet
Development

No branches or pull requests

3 participants