Sygil-Dev / stable-diffusion

GNU Affero General Public License v3.0
1.72k stars 148 forks source link

[BUG] Output not displayed when generating a 3 or more batches after a previous generation #121

Closed aekaisato closed 2 years ago

aekaisato commented 2 years ago

Describe the bug I am currently using altryne's colab for the WebUI, and any generations with 3 or more batches of images don't output onto Gradio. However, they save to Google Drive perfectly fine. I'll put much more detail to (hopefully) help debug in "additional context".

To Reproduce Steps to reproduce the behavior:

  1. Run Stable Diffusion on the colab (run all -> run after -> open gradio link)
  2. Set batch count to 3 or more, keeping all other settings as default (I've tested with 3, 4, and 5 batches)
  3. After generation is complete. generate another set of images with the same settings

Expected behavior Images would display on gallery component in the WebUI over multiple generations, not just the first one.

Screenshots Screenshot 2022-08-29 at 20-37-54 Stable Diffusion WebUI

Desktop (please complete the following information):

Additional context I monitored the console and network tabs in Firefox DevTools, and found that /predict POST request actually does complete, but a DOMException is thrown. Looking at the response JSON, I found that there was typically one image that was sent corrupted, and doesn't display in some image viewers. Additionally, pngcheck returns zlib: inflate error = -3 (data error). Since the images successfully save to Google Drive uncorrupted, the images are actually generated successfully, they just aren't sent properly to the browser client. I decoded the base64 PNGs for some generations, both uncorrupted and corrupted, and placed them with their uncorupted Google Drive outputs and the JSON response data for the generation: 4 batches generated twice with the same seed - 4-batch_sameseed.zip generating images, increasing the number by 1 every time - n-batch.zip The corrupted images have some amount of "correct" data at the start of the base64 string, but it eventually cuts off and is replaced with improper data I'm not sure the source of. My file manager preview thumbnail shows other images in the data, but GIMP shows it as cutting off, and my image viewer, nomacs, is unable to open the file entirely. screenshot of thumbnail screenshot of gimp What's perhaps even more baffling is that Chromium throws net::ERR_HTTP2_PROTOCOL_ERROR 200 in the exact same circumstances as the DOMException, where generating one or two images works fine, but three or more throws and error. In Chromium I am unable to access the JSON output. I have nothing else to add with this info, but I hope it helps.

Tollanador commented 2 years ago

This is a bug of Gradio, I think it was mentioned it's potentially due to the way they do their SSH tunnelling or something. If generation time takes longer than ~60 seconds.

https://github.com/gradio-app/gradio/issues/2111 https://github.com/gradio-app/gradio/issues/1337

hlky commented 2 years ago

Colab issue, not a bug. As in, it's just something that happens when using colab, it's not a bug in the notebook itself.