lshqqytiger / stable-diffusion-webui-amdgpu

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

[Bug]: Sampler API failing #312

Closed Dalethium closed 7 months ago

Dalethium commented 11 months ago

Is there an existing issue for this?

What happened?

samplers api returns an error when using onnx olive

Steps to reproduce the problem

  1. follow this guide: https://community.amd.com/t5/ai/updated-how-to-running-optimized-automatic1111-stable-diffusion/ba-p/630252 or setup the environment by hand and optimize SD
  2. open /sdapi/v1/samplers
  3. get error

What should have happened?

a return of the samplers

Sysinfo

sysinfo-2023-11-02-13-43.txt

What browsers do you use to access the UI ?

Brave

Console logs

venv "C:\Root\ai\stable-diffusion-webui-directml\venv\Scripts\Python.exe"
fatal: No names found, cannot describe anything.
Python 3.10.10 (tags/v3.10.10:aad5f6a, Feb  7 2023, 17:20:36) [MSC v.1929 64 bit (AMD64)]
Version: 1.6.0
Commit hash: 64e6b0687e182d5f17216755561c9c143d69c220
Installing onnxruntime
Installing onnxruntime-directml
Installing Olive
Launching Web UI with arguments: --api --listen --backend directml --onnx --enable-insecure-extension-access
no module 'xformers'. Processing without...
No SDP backend available, likely because you are running in pytorch versions < 2.0. In fact, you are using PyTorch 1.13.1+cpu. You might want to consider upgrading.
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
==============================================================================
You are running torch 1.13.1+cpu.
The program is tested to work with torch 2.0.0.
To reinstall the desired version, run with commandline flag --reinstall-torch.
Beware that this will cause a lot of large files to be downloaded, as well as
there are reports of issues with training tab on the latest version.

Use --skip-version-check commandline argument to disable this check.
==============================================================================
Model stable-diffusion-v1-5 [Optimized] loaded.
Applying attention optimization: InvokeAI... done.
C:\Root\ai\stable-diffusion-webui-directml\modules\ui.py:1665: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  with gr.Row().style(equal_height=False):
C:\Root\ai\stable-diffusion-webui-directml\modules\ui.py:1787: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  with gr.Row().style(equal_height=False):
Running on local URL:  http://0.0.0.0:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 11.3s (prepare environment: 3.0s, import torch: 2.1s, import gradio: 1.0s, setup paths: 1.2s, initialize shared: 0.7s, other imports: 0.4s, load scripts: 0.7s, create ui: 0.4s, gradio launch: 4.3s).
*** API error: GET: http://192.168.6.216:7860/sdapi/v1/samplers {'error': 'ValidationError', 'detail': '', 'body': '', 'errors': '8 validation errors for SamplerItem\nresponse -> 0 -> options\n  none is not an allowed value (type=type_error.none.not_allowed)\nresponse -> 1 -> options\n  none is not an allowed value (type=type_error.none.not_allowed)\nresponse -> 2 -> options\n  none is not an allowed value (type=type_error.none.not_allowed)\nresponse -> 3 -> options\n  none is not an allowed value (type=type_error.none.not_allowed)\nresponse -> 4 -> options\n  none is not an allowed value (type=type_error.none.not_allowed)\nresponse -> 5 -> options\n  none is not an allowed value (type=type_error.none.not_allowed)\nresponse -> 6 -> options\n  none is not an allowed value (type=type_error.none.not_allowed)\nresponse -> 7 -> options\n  none is not an allowed value (type=type_error.none.not_allowed)'}
    Traceback (most recent call last):
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\anyio\streams\memory.py", line 98, in receive
        return self.receive_nowait()
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-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 "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\starlette\middleware\base.py", line 78, in call_next
        message = await recv_stream.receive()
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-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 "C:\Root\ai\stable-diffusion-webui-directml\modules\api\api.py", line 187, in exception_handling
        return await call_next(request)
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\starlette\middleware\base.py", line 84, in call_next
        raise app_exc
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\starlette\middleware\base.py", line 70, in coro
        await self.app(scope, receive_or_disconnect, send_no_error)
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\starlette\middleware\base.py", line 108, in __call__
        response = await self.dispatch_func(request, call_next)
      File "C:\Root\ai\stable-diffusion-webui-directml\modules\api\api.py", line 151, in log_and_time
        res: Response = await call_next(req)
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\starlette\middleware\base.py", line 84, in call_next
        raise app_exc
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\starlette\middleware\base.py", line 70, in coro
        await self.app(scope, receive_or_disconnect, send_no_error)
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\starlette\middleware\cors.py", line 84, in __call__
        await self.app(scope, receive, send)
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\starlette\middleware\gzip.py", line 24, in __call__
        await responder(scope, receive, send)
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\starlette\middleware\gzip.py", line 44, in __call__
        await self.app(scope, receive, self.send_with_gzip)
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
        raise exc
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
        await self.app(scope, receive, sender)
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in __call__
        raise e
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__
        await self.app(scope, receive, send)
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\starlette\routing.py", line 718, in __call__
        await route.handle(scope, receive, send)
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\starlette\routing.py", line 276, in handle
        await self.app(scope, receive, send)
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\starlette\routing.py", line 66, in app
        response = await func(request)
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\fastapi\routing.py", line 255, in app
        content = await serialize_response(
      File "C:\Root\ai\stable-diffusion-webui-directml\venv\lib\site-packages\fastapi\routing.py", line 141, in serialize_response
        raise ValidationError(errors, field.type_)
    pydantic.error_wrappers.ValidationError: 8 validation errors for SamplerItem
    response -> 0 -> options
      none is not an allowed value (type=type_error.none.not_allowed)
    response -> 1 -> options
      none is not an allowed value (type=type_error.none.not_allowed)
    response -> 2 -> options
      none is not an allowed value (type=type_error.none.not_allowed)
    response -> 3 -> options
      none is not an allowed value (type=type_error.none.not_allowed)
    response -> 4 -> options
      none is not an allowed value (type=type_error.none.not_allowed)
    response -> 5 -> options
      none is not an allowed value (type=type_error.none.not_allowed)
    response -> 6 -> options
      none is not an allowed value (type=type_error.none.not_allowed)
    response -> 7 -> options
      none is not an allowed value (type=type_error.none.not_allowed)

---

Additional information

No response

Dalethium commented 11 months ago

I've forked the repo with a fix, I won't be making a pull request as you have higher contribution standards than I have time to review and uphold at this time, but I'll leave the repo up with the fix until it is fixed in the main repo.

Dalethium commented 11 months ago

another related issue I fixed here: https://github.com/Dalethium/stable-diffusion-webui-directml/tree/patch-2

this is the original fix for samplers https://github.com/Dalethium/stable-diffusion-webui-directml/tree/patch-1