stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: SwinIR 4x keeps crashing Python

Open 925-Studio opened this issue 2 years ago • 14 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

Upscale with SwinIR 4x keeps crash.

Steps to reproduce the problem

  1. Generate or pick an existing picture, 512512 or 512768
  2. Send it to Extra
  3. Select SwinIR 4x in dropdown menu
  4. Hit the generate button and the system warning pops up: Python quit unexpectedly.

What should have happened?

It should work like R-ESRGAN 4x+ without problems.

Commit where the problem happens

0cc0ee1b

What platforms do you use to access the UI ?

MacOS

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

--upcast-sampling --opt-sub-quad-attention --use-cpu interrogate

List of extensions

ControlNet Additional Networks

Console logs

SwinIR tiles:   0%|                                                                               | 0/9 [00:00<?, ?it/s]loc("mps_multiply"("(mpsFileLoc): /AppleInternal/Library/BuildRoots/9e200cfa-7d96-11ed-886f-a23c4f261b56/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm":228:0)): error: input types 'tensor<1x36864x480xf16>' and 'tensor<1xf32>' are not broadcast compatible
LLVM ERROR: Failed to infer result type(s).
[1]    4994 abort      ./webui.sh
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '

Additional information

Mac mini M1 + 16GB ram + 512GB SD + Ventura 13.2.1

925-Studio avatar Feb 24 '23 08:02 925-Studio

The same issue is happening to me trying to upscale an image.

This seems to have been broken for a while: I used git checkout to go back in time. A coarse examination shows this happened between these two commits:

ba6a4e7e9431d02ba3656c6ae44d5dfe29908d68

aede265f1d6d512ca9e51a305e98a96a215366c4

The one visual difference between these two is that the old (where this does not crash) still uses radio buttons rather than a dropdown to select the upscalers. I suspect something went wrong when this UI was changed.

zorzella avatar Feb 26 '23 00:02 zorzella

Correction: it seems like there is still some kind of error at the earlier git commit I posted, it's just it does not quite crash the same way. Let me go further back in time to see if I can find a properly-working commit.

zorzella avatar Feb 26 '23 00:02 zorzella

I went as far back as

ec0a48826fb41c1b1baab45a9030f7eb55568fd0

but the output is still garbled... FWIW different upscalers seem to be working correctly -- this is just the SwinIR 4x.

zorzella avatar Feb 26 '23 00:02 zorzella

I went as far back as

ec0a488

but the output is still garbled... FWIW different upscalers seem to be working correctly -- this is just the SwinIR 4x.

Thanks for the info, I not sure it's because the mac os enviroment or something else. May it's the acceleration because I found no troubles when I use it on Colab which is using the xformers.

925-Studio avatar Feb 26 '23 05:02 925-Studio

Is there anything I can do to help you diagnose this? E.g. Is there a way to turn off the acceleration you're speaking about?

zorzella avatar Feb 26 '23 06:02 zorzella

Thank you for your kindness but I have to admit it's bit complicate to diagnose in my case. See I'm using sd-webui on M1 + Ventura system and the acceleration method is using torch nightly version. I found this method in here and it seems not much people is using it. I can stick with R-ESRGAN 4x+ for now and the result is almost as good as SwinIR 4x except some little details.

925-Studio avatar Feb 26 '23 06:02 925-Studio

@zorzella If it's not too much to ask, can you help me with this new discover. I started a fresh installation of sd-webui and SwinIR 4x seems work, but the result is very strange. There's no error in terminal. I attached the picture at below. 00003

Thanks for your time.

925-Studio avatar Feb 27 '23 10:02 925-Studio

Same:

SwinIR-A

SwinIR-B

32Gb M1 Mac Macbook python: 3.10.10 torch: 2.0.0.dev20230210 xformers: N/A gradio: 3.16.2

don1138 avatar Mar 07 '23 02:03 don1138

Same here, discoloration and geometrical lines when trying to use SwinIR on Mac...

BigZampano avatar Mar 08 '23 11:03 BigZampano

Hi everyone, same here today. Everything has been working perfectly on my 16GB M1 iMac (as long as I watch my file sizes) and the pressure on the SSD has been very good. I have been UpScaling with SwinIR successfully for a couple of weeks now since install and I don't think I've updated anything in A1111? But this morning, I selected it for UpScaling and it crashed-out Python:

SwinIR tiles:   0%|                                                      | 0/9 [00:00<?, ?it/s]loc("mps_multiply"("(mpsFileLoc): /AppleInternal/Library/BuildRoots/0aa643d0-625a-11ed-b319-a23c4f261b56/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm":228:0)): error: input types 'tensor<1x36864x480xf16>' and 'tensor<1xf32>' are not broadcast compatible
LLVM ERROR: Failed to infer result type(s).
Abort trap: 6
(base) BRIANs-iMac:stable-diffusion-webui Brian$ /opt/homebrew/Cellar/[email protected]/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d

This only seems to happen with SwinIR now and can't understand why as it working yesterday fine?

OrganicBeej avatar Mar 08 '23 14:03 OrganicBeej

Same proble, strange artifacts when working and frequent crashes on m1 pro 16gb

StefanoMarchesi avatar Mar 09 '23 15:03 StefanoMarchesi

00000 Over here too - even worse artifacts happening. Running on 16" MBP 2021 M1 Max with 64GB Ram on macOS 13.2.1

mariussteffen avatar Mar 10 '23 18:03 mariussteffen

Same proble

imDazui avatar Mar 20 '23 06:03 imDazui

fixed for me on Mac MBA M1 by decreasing tile size settings > upscaling > SwinIR tile size to 128 ish

wclifton1 avatar May 13 '23 04:05 wclifton1