MacOS black image generation.
I keep running into the same error with most samplers, for a while now and with the latest commit f1.0.2v1.10.1-previous-214-gdad1d17f.
I did try on 2 different Apple Silicon Machines on with MacOS 14.6.1 and one with beta 5 of MacOS 15.
stable-diffusion-webui-forge/modules/processing.py:990: RuntimeWarning: invalid value encountered in cast x_sample = x_sample.astype(np.uint8)
or
stable-diffusion-webui-forge/modules/sd_samplers_common.py:75: RuntimeWarning: invalid value encountered in cast x_sample = x_sample.astype(np.uint8)
Update:
sometime I get both, did 20 steps DPM++ 2M using 1024 x 1024 px and at step 11 I get stable-diffusion-webui-forge/modules/sd_samplers_common.py:75: RuntimeWarning: invalid value encountered in cast x_sample = x_sample.astype(np.uint8)
At the end I get /stable-diffusion-webui-forge/modules/processing.py:990: RuntimeWarning: invalid value encountered in cast x_sample = x_sample.astype(np.uint8)
Wondering if it is caused by the same math rounding issues some used to have. https://github.com/vladmandic/automatic/issues/2012
Samplers tested: DDIM = works DPM++ 2M = broken DPM++ SDE = broken DPM++ 2M SDE = broken DPM++ 2sa = broken DPM++ 3M DES = works Euler a = broken Euler = works UniPC = works
These work fine in A1111 however (on the same machines).
issue remains with version : f2.0.1v1.10.1-previous-223-g86ee2d94
Hello, I updated to 14.6.1 yesterday and now I have the same problem. Is there already a solution?
+1 (SDXL)
Sometimes Euler a (Normal) works if you keep trying the generate after the black image. If you see it turn green in the preview double click interupt and try again.
The issue sure is a bit weird sometimes I think it is fixed change sampler or scheduler and the error is back.
I think it is not the samplers that are broken but some schedulers.
Euler a, on auto, normal l, ays11 did work, karras and simple did not.
I think it is not the samplers that are broken but some schedulers.
Yea, I guess I'll have to stick to SGM Uniform for now until this (hopefully) gets addressed.
Also hit similar problem - some scheduler/sampler pairs always produce black images on M3 - and thankfully same problem was with Comfy and same solution helped me. It is "--force-upcast-attention" command line option, with this option Karras and DPM++ 2M SDE work without black images. Full command line for reference: --api --skip-torch-cuda-test --upcast-sampling --force-upcast-attention --no-half-vae --all-in-fp16 --always-high-vram --use-cpu interrogate
Also hit similar problem - some scheduler/sampler pairs always produce black images on M3 - and thankfully same problem was with Comfy and same solution helped me. It is "--force-upcast-attention" command line option, with this option Karras and DPM++ 2M SDE work without black images. Full command line for reference: --api --skip-torch-cuda-test --upcast-sampling --force-upcast-attention --no-half-vae --all-in-fp16 --always-high-vram --use-cpu interrogate
this helped a lot. I am using a macbook pro with 16gb ram (low vram for this) using pytorch and I was able to load Juggernaut XL without black images by cutting off just the last part in the webui-user.sh:
export COMMANDLINE_ARGS="--api --skip-torch-cuda-test --upcast-sampling --force-upcast-attention --no-half-vae"
I'm having the same problem whenever I increase the batch count above one. The first image comes out, but any subsequent images are black boxes. I can see the images while they are generating, but when it's finished, they are black.
I'm using a M1 MacBook with 16GB RAM. I've been able to use A1111, but not Forge. I would prefer Forge for various reasons.
I added COMMANDLINE_ARGS="--api --skip-torch-cuda-test --upcast-sampling --force-upcast-attention --no-half-vae" to webui.sh but it didn't fix the issue.
Does anyone have a better idea?
Im using a M1 Pro with 16GB RAM and have the same problem of subsequent images being black. the command line did not fix the issue, too
there seems to be no way around it unless I add --force-upcast-attention I get black pictures even with pytorch 2.7.
My webui-macos-env.sh not looks like this.
export install_dir="$HOME" export COMMANDLINE_ARGS="--skip-torch-cuda-test --upcast-sampling --force-upcast-attention --no-half-vae --use-cpu interrogate" export PYTORCH_ENABLE_MPS_FALLBACK=1
if [[ "$(sysctl -n machdep.cpu.brand_string)" =~ ^."Intel".$ ]]; then export TORCH_COMMAND="pip install torch==2.1.2 torchvision==0.16.2" else export TORCH_COMMAND="pip install torch==2.7.0 torchvision==0.22.0" fi
My guess is and I am not a programmer, that the problem comes down to MPS not supporting FP8
Also hit similar problem - some scheduler/sampler pairs always produce black images on M3 - and thankfully same problem was with Comfy and same solution helped me. It is "--force-upcast-attention" command line option, with this option Karras and DPM++ 2M SDE work without black images. Full command line for reference: --api --skip-torch-cuda-test --upcast-sampling --force-upcast-attention --no-half-vae --all-in-fp16 --always-high-vram --use-cpu interrogate
I can confirm that this works on my M2 Max with 96gb RAM.