yownas / shift-attention

In stable diffusion, generate a sequence of images shifting attention in the prompt.
Other
164 stars 17 forks source link

Crash when running twice with drop frames enabled #10

Closed gitmylo closed 1 year ago

gitmylo commented 1 year ago

I think it's drop frames at least, could also be RIFE. As the title says, when i run shift-attention twice, the second time it will generate the first image, then crash the webui. And the console just says press any key to continue. because the webui script closed.

--- Shift Attention settings (from first run, for second run i reran without changing settings. that crashed it) --- Steps: 30 FPS: 30.0 Lead in/out: 0 SSIM threshold: 0.5 SSIM CenterCrop%: 0 RIFE passes: 3 Drop original frames: True Upscaler: None Upscale ratio: 1 SSIM min substep: 0.0001 SSIM min threshold: 75 --------------------------------------- Stats: Skip count: 0 Worst: 1.0 No improvment: 0 Min. step: 1.0 Frames: 31

yownas commented 1 year ago

It managed to generate one image?

Trying to think of what could be the problem, since most of the things that could go wrong in the script either happen before it starts generating or when it gets to the SSIM part.

My best guess would be running out of VRAM (gpu memory), but you would have shown up as a big angry error message, not silently kill the script.

(EDIT: OR running out of normal memory, but same thing there, it should have shown up as an error.)

gitmylo commented 1 year ago

first it manages to generate the entire animation, with no issues. everything works fine. but when i hit generate again after it completes to generate another animation. it crashes after rendering the first frame.

This shouldn't be from be from running out of memory as the first run always works fine. unless there's a memory leak somewhere.

here's the console when the crash happens, i used generations of 6 sampler steps so i would be able to produce it quickly, bu tit does this on any amount of sampler steps.

100%|████████████████████████████████████████████████████████████████████████████████████| 6/6 [00:01<00:00,  5.03it/s]
Exception ignored in: <function Image.__del__ at 0x0000017E9232C8B0>                    | 6/60 [00:00<00:09,  5.51it/s]
Traceback (most recent call last):
  File "C:\Users\milan\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 4046, in __del__
    self.tk.call('image', 'delete', self.name)
RuntimeError: main thread is not in main loop
Exception ignored in: <function Variable.__del__ at 0x0000017E92147130>
Traceback (most recent call last):
  File "C:\Users\milan\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 388, in __del__
    if self._tk.getboolean(self._tk.call("info", "exists", self._name)):
RuntimeError: main thread is not in main loop
Exception ignored in: <function Variable.__del__ at 0x0000017E92147130>
Traceback (most recent call last):
  File "C:\Users\milan\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 388, in __del__
    if self._tk.getboolean(self._tk.call("info", "exists", self._name)):
RuntimeError: main thread is not in main loop
Exception ignored in: <function Variable.__del__ at 0x0000017E92147130>
Traceback (most recent call last):
  File "C:\Users\milan\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 388, in __del__
    if self._tk.getboolean(self._tk.call("info", "exists", self._name)):
RuntimeError: main thread is not in main loop
Exception ignored in: <function Variable.__del__ at 0x0000017E92147130>
Traceback (most recent call last):
  File "C:\Users\milan\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 388, in __del__
    if self._tk.getboolean(self._tk.call("info", "exists", self._name)):
RuntimeError: main thread is not in main loop
Tcl_AsyncDelete: async handler deleted by the wrong thread
Press any key to continue . . .

the first run doesn't have any errors show up,

yownas commented 1 year ago

I haven't seen that before, but from what I can find it seems like it has something to do with matplotlib (the library that is used to generate some statistics). Can you try to open up "Shift Attentions Extras" and uncheck "Save extra status information" and see if it changes anything?

image

gitmylo commented 1 year ago

that's it! it didn't crash when "Save extra status information" was disabled. so it seems there's something wrong there.

yownas commented 1 year ago

I couldn't reproduce the error myself, but I might have found a fix for it.

gitmylo commented 1 year ago

This fixed it, thanks.