sd-webui-depth-lib icon indicating copy to clipboard operation
sd-webui-depth-lib copied to clipboard

Quick fix for KeyError: 'dataset'

Open jtydhr88 opened this issue 1 year ago • 14 comments

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 avatar Aug 07 '23 15:08 jtydhr88

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 avatar Aug 07 '23 15:08 jtydhr88

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)

jtydhr88 avatar Aug 07 '23 15:08 jtydhr88

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

alexbofa avatar Aug 08 '23 12:08 alexbofa

@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.

jtydhr88 avatar Aug 08 '23 12:08 jtydhr88

works for me also

webcoderz avatar Aug 08 '23 12:08 webcoderz

gr.gallery solution looks okay and possible

webcoderz avatar Aug 08 '23 12:08 webcoderz

@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

alexbofa avatar Aug 08 '23 12:08 alexbofa

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?

pipa0979 avatar Aug 15 '23 16:08 pipa0979

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

webcoderz avatar Aug 15 '23 19:08 webcoderz

@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

jtydhr88 avatar Aug 15 '23 20:08 jtydhr88

it works,thanks a lot

moosescap avatar Sep 02 '23 08:09 moosescap

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:

  • Delete the venv folder
  • Delete the Miaoshouai-assistant folder in /extensions
  • Run webui-user.bat

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 ♥

Winters-Glade avatar Sep 23 '23 10:09 Winters-Glade

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

It worked for me. Thank you

XMUykyz avatar Jan 08 '24 08:01 XMUykyz

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

alexbofa avatar Jan 08 '24 08:01 alexbofa