stable-diffusion-webui
stable-diffusion-webui copied to clipboard
[Bug]: Upscaling fails on Apple Silicon
Is there an existing issue for this?
- [X] I have searched the existing issues and checked the recent builds/commits
What happened?
Python crashes when upscaling is run from a base resolution of 512x1024. Upscaling does seem to work for 512x512.
Steps to reproduce the problem
- Input any prompt
- Select any upscaler
- Set image to 512x1024
- Generate an image
What should have happened?
Upscaling should have completed successfully
Commit where the problem happens
5ab7f213
What platforms do you use to access the UI ?
MacOS
What browsers do you use to access the UI ?
Mozilla Firefox
Command Line Arguments
--skip-torch-cuda-test --upcast-sampling --no-half-vae --use-cpu interrogate
List of extensions
None. This fails using absolutely nothing other than the base stable diffusion model.
Console logs
./webui.sh
################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################
################################################################
Running on XXXXXX user
################################################################
################################################################
Repo already cloned, using it as install directory
################################################################
################################################################
Create and activate python venv
################################################################
################################################################
Launching launch.py...
################################################################
Python 3.10.11 (main, Apr 7 2023, 07:24:53) [Clang 14.0.0 (clang-1400.0.29.202)]
Commit hash: 5ab7f213bec2f816f9c5644becb32eb72c8ffb89
Installing requirements
Launching Web UI with arguments: --skip-torch-cuda-test --upcast-sampling --no-half-vae --use-cpu interrogate
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled
No module 'xformers'. Proceeding without it.
Loading weights [f300684443] from /Users/apwagner/Projects/stable-diffusion-webui/models/Stable-diffusion/f222.safetensors
Creating model from config: /Users/apwagner/Projects/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying cross attention optimization (InvokeAI).
Textual inversion embeddings loaded(0):
Model loaded in 1.8s (load weights from disk: 0.2s, create model: 0.5s, apply weights to model: 0.4s, apply half(): 0.2s, move model to device: 0.5s).
Running on local URL: http://127.0.0.1:7860
100%|ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ| 20/20 [00:26<00:00, 1.32s/it]
0%| | 0/20 [00:00<?, ?it/s]/AppleInternal/Library/BuildRoots/9941690d-bcf7-11ed-a645-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Types/MPSNDArray.mm:706: failed assertion `[MPSTemporaryNDArray initWithDevice:descriptor:] Error: NDArray dimension length > INT_MAX'0:30, 1.26s/it]
zsh: abort ./webui.shâââââââââââââââââââââ | 11/40 [00:23<00:38, 1.33s/it]
(base) apwagner@Andrews-MBP-2 stable-diffusion-webui % /opt/homebrew/Cellar/[email protected]/3.10.11/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
No response
+1
+1
This is because your mac has insufficient resources to generate this picture. So either do not generate such a large picture, or you need to use a better mac
@dongweiming That's untrue. This is a limitation of the MPS backend:
/AppleInternal/Library/BuildRoots/9941690d-bcf7-11ed-a645-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Types/MPSNDArray.mm:706: failed assertion `[MPSTemporaryNDArray initWithDevice:descriptor:] Error: NDArray dimension length > INT_MAX
@dongweiming That's untrue. This is a limitation of the MPS backend:
/AppleInternal/Library/BuildRoots/9941690d-bcf7-11ed-a645-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Types/MPSNDArray.mm:706: failed assertion `[MPSTemporaryNDArray initWithDevice:descriptor:] Error: NDArray dimension length > INT_MAX
Getting the same error when doing "Hires. fix" but after a bit of testing I figured it only dies when I use Doggettx
as cross attention optimization.
When leaving to Auto (which picks InvokeAI in my case) it upscales with no issues to a reasonable resolution within my HW specs (32gb ram on macmini m2 pro).
I had the exact same issue with Vlad's Automatic but InvokeAI fixes it there too.