jexom / sd-webui-depth-lib

Depth map library for use with the Control Net extension for Automatic1111/stable-diffusion-webui
MIT License
1.41k stars 141 forks source link

Quick fix for KeyError: 'dataset' #36

Open jtydhr88 opened 1 year ago

jtydhr88 commented 1 year ago

Hi there, If you are facing KeyError: 'dataset' issue, you can fix by:

  1. go to your webui_folder\venv\Lib\site-packages\gradio_client and edit serializing.py file
  2. go to the end of the serializing.py, and add one line inside COMPONENT_MAPPING: "dataset": StringSerializable, it should look like after modifing: image
  3. Save
  4. Restart your webui.

it should work well now, I tested 900 hands on webui latest version 1.5.1 + gradio 3.32.0 + gradio_client 0.3.0

it should fix the issues:

  1. https://github.com/jexom/sd-webui-depth-lib/issues/32
  2. https://github.com/jexom/sd-webui-depth-lib/issues/35
  3. https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/11855
jtydhr88 commented 1 year ago

I know webui plans to update gradio to latest(3.39) in later release v1.6.0 (see https://github.com/richrobber2/canvas-zoom/issues/88), but likely it still lost dataset map in https://github.com/gradio-app/gradio/blob/v3.39.0/client/python/gradio_client/serializing.py

jtydhr88 commented 1 year ago

there are several ways to fix the issue permanently:

  1. I am not sure the reason why gradio miss this code, it may have some reasons, but it could be gradio client bug, should be fixed in gradio side.
  2. replace the code https://github.com/jexom/sd-webui-depth-lib/blob/efa9f616b30ea0f27e5dadf40ab41815012d1d78/scripts/main.py#L47 using gr.Examples by another way to show the image lib, may could be gallery component https://www.gradio.app/docs/gallery I guess.
  3. totally give up gradio component and use other tech, like pure javascript instead to display the image lib (as a webui extension developer, I prefer to rebuild my page by HTML/CSS/JS rather than using gradio honstlly)
alexbofa commented 1 year ago

Hello. Thank you, helped with the replacement serializing.py

Do you know why don't show pictures? There are no errors in the console. I think it's because of the symbolic link to the extension https://github.com/jexom/sd-webui-depth-lib/issues/29 Screen-1544

jtydhr88 commented 1 year ago

@alexbofa i don’t see the issue that images not show up on my side, I tested the default images from this extension and 900 hands, and they work well. If you could provide more information I may help.

webcoderz commented 1 year ago

works for me also

webcoderz commented 1 year ago

gr.gallery solution looks okay and possible

alexbofa commented 1 year ago

@alexbofa i don’t see the issue that images not show up on my side, I tested the default images from this extension and 900 hands, and they work well. If you could provide more information I may help.

I didn't have time to fix the message, because I found a problem in the issue. It's possible, as I wrote in the updated post, that the problem is that I'm using a symbolic link for "Extensions" https://github.com/jexom/sd-webui-depth-lib/issues/29 image

pipa0979 commented 1 year ago

2. by another way to show the image lib, may could b

dataset = gr.Examples(examples=os.path.join(maps_path, t), inputs=[png_input_area],examples_per_page=24,label="Depth Maps", elem_id="examples")

Should be replaced by what?

webcoderz commented 1 year ago

gonna have to do this: https://github.com/jexom/sd-webui-depth-lib/issues/36#issue-1839673234

jtydhr88 commented 1 year ago

@pipa0979 you don’t need to do that you pointed out, that’s some my personal suggestions for the extension author or someone who wants to contribute the fix. To fix it quickly you just need to do my first comment as @webcoderz showing

moosescap commented 1 year ago

it works,thanks a lot

Winters-Glade commented 1 year ago

TLDR: The problem for me was miaoshouai-assistant. Removed it, deleted venv folder. Works now.

Longer version: I had tried everything I found on this page and a few others with no luck. I can't say whether or not anything on this page helped my solution mentioned here work better or if there was no effect. All I know is the fixes didn't work until I removed the miaoshouai-assistant extension. I really liked that extension and hope it's updated to working again for me.

Steps I performed to get my stable diffusion working again:

The venv folder was rebuilt and started working. The reason I take extra care to point this out is because I tried running SD with no extensions in the /extensions folder and still got the same error. I can only guess that miaoshouai-assistant puts something in the folder that causes the issue, or requires a dependency that causes the issue.

Hope this helps ♥

XMUykyz commented 9 months ago

你不需要这样做,你指出的,这是我对扩展作者或想要贡献修复的人的一些个人建议。要快速修复它,您只需要按照所示执行我的第一条评论即可

It worked for me. Thank you

alexbofa commented 9 months ago

@XMUykyz Hello, download this fork: https://github.com/wywywywy/sd-webui-depth-lib