sdwebui-w-horde / sd-webui-stable-horde-worker

Stable Horde Unofficial Worker Bridge as Stable Diffusion WebUI (AUTOMATIC1111) Extension
GNU Affero General Public License v3.0
60 stars 19 forks source link

[Bug]: #95

Closed ghost closed 1 year ago

ghost commented 1 year ago

Is there existing issue for this?

Does this happen on the latest commit?

What happened?

On startup from stable diffusion, this error occurs: To create a public link, set share=True in launch(). Error executing callback app_started_callback for E:\StableDiffusion\stable-diffusion-webui\extensions\sd-webui-stable-horde-worker\scripts\script.py Traceback (most recent call last): File "E:\StableDiffusion\stable-diffusion-webui\modules\script_callbacks.py", line 108, in app_started_callback c.callback(demo, app) File "E:\StableDiffusion\stable-diffusion-webui\extensions\sd-webui-stable-horde-worker\scripts\script.py", line 18, in on_app_started gradio.utils.synchronize_async(horde.run) AttributeError: module 'gradio.utils' has no attribute 'synchronize_async'

Startup time: 25.2s (import torch: 8.3s, import gradio: 1.3s, import ldm: 0.8s, other imports: 2.0s, scripts before_ui_callback: 5.4s, create ui: 7.0s, gradio launch: 0.2s)

Stable horde worker is not working

Steps to reproduce

No response

What did you expect to happen?

There should be no error and stable horde worker should be working

Stable Diffusion WebUI Commit SHA

5ab7f213

What operating system are you seeing the problem on?

Windows 11 / 10 / 8

What browsers are you seeing the problem on?

Firefox, Chrome

Additional information

No response

Kryptortio commented 1 year ago

I don't really know Gradio or Python but until there is a proper fix you can try this (use at your own risk) . The issue could be that Gradio has been updated in AUTOMATIC1111, there was a pretty large update recently.

Open the file \extensions\sd-webui-stable-horde-worker\scripts\script.py

Go to line 16, change those lines to

    #import gradio.utils

    #gradio.utils.synchronize_async(horde.run)
    import fsspec.asyn
    return fsspec.asyn.sync(fsspec.asyn.get_loop(), horde.run) 

Then save and restart.

Still doesn't work well as it throws a lot of errors but looks like it does accept and complete jobs, I only did a short test though.

jmsether commented 1 year ago

I actually did a more proper fix using what gradio used to use as gradio uses asyncio. I did a PR but don't know if or when that will get approved. image

You can replace the lines above in extensions > sd-webui-stable-horde-worker > scripts > script.py here is the raw text.

def on_app_started(demo: Optional[gr.Blocks], app: FastAPI):
    import asyncio

    loop = asyncio.get_event_loop()
    loop.run_until_complete(horde.run())

This will run the same as it used to. If you have questions I would be more than happy to help.

MaikoTan commented 1 year ago

This should be fixed by @jmsether in #96 . Thank you!