lllyasviel / lllyasviel/stable-diffusion-webui-forge

Black image problem in raw images and fatal error problem in LayerDiffiuse

Open
#2,615 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

Problem 2: After startup, there is an 80% -90% chance of generating a single image with a black image.
Additionally, the code for converting tensors to out of bounds issues has been modified as follows:

x_sample = torch.clamp(x_sample, min=0.0, max=1.0)

x_sample = 255. * np.moveaxis(x_sample.cpu().numpy(), 0, 2)

x_sample = x_sample.astype(np.uint8)

No error reported after modifying to console
x_sample = torch.clamp(x_sample, min=0.0, max=1.0)
x_sample = 255. * np.moveaxis(x_sample.cpu().numpy(), 0, 2)
x_sample = np.nan_to_num(x_sample, nan=0.0, posinf=255.0, neginf=0.0)
x_sample = np.clip(x_sample, 0, 255).astype(np.uint8)

Problem 2. After startup, there is a 50% -60% chance of generating a single image with a black image. Generate two images at once, one normal and one black image, and generate four normal images at once.

Problem 3. Generate 4 images using LayerDiffiuse, but there is an error message at the end of the output.
Operating system information Apple M2 Max memory 96G MACOS13.4
The following is console information.
Multiple models have been tried. It's all this mistake, including the 1.5 model. DSXL model

[Unload] Trying to free all memory for mps with 0 models keep loaded ... Done.
StateDict Keys: {'unet': 686, 'vae': 248, 'text_encoder': 197, 'ignore': 0}
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
K-Model Created: {'storage_dtype': torch.float16, 'computation_dtype': torch.float16}
Calculating sha256 for /Users/yunhai/Documents/AI/stable-diffusion/stable-diffusion-webui-env/stable-diffusion-webui/models/Stable-diffusion/revAnimated_v1.1-动漫.safetensors: 88eaf53bdacba86931fb36984aabfe537d9eddd0f0fea47454e1adea35de68ec
Model loaded in 1.9s (unload existing model: 0.2s, forge model load: 1.7s).
All loaded to GPU.
Moving model(s) has taken 0.00 seconds
[LayerDiffuse] LayerMethod.FG_ONLY_ATTN_SD15
[Unload] Trying to free 3187.23 MB for mps with 0 models keep loaded ... Current free memory is 44374.38 MB ... Done.
All loaded to GPU.
Moving model(s) has taken 0.39 seconds
100%|███████████████████████████████████████████| 20/20 [00:10<00:00, 1.84it/s]
[Unload] Trying to free 3137.35 MB for mps with 0 models keep loaded ... Current free memory is 40673.12 MB ... Done.
All loaded to GPU.
Moving model(s) has taken 0.09 seconds
[Unload] Trying to free 1282.13 MB for mps with 0 models keep loaded ... Current free memory is 41977.27 MB ... Done.
All loaded to GPU.
Moving model(s) has taken 0.10 seconds
100%|█████████████████████████████████████████████| 8/8 [00:03<00:00, 2.40it/s]
/AppleInternal/Library/BuildRoots/2acced82-df86-11ed-9b95-428477786501/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSNDArray/Kernels/MPSNDArraySort.mm:283: failed assertion `(null)" Axis = 4. This class only supports axis = 0, 1, 2, 3
'
./webui.sh: line 304: 13837 Abort trap: 6 "${python_cmd}" -u "${LAUNCH_SCRIPT}" "$@"
(base) yunhai@192 stable-diffusion-webui-forge % /Users/yunhai/miniconda3/lib/python3.12/multiprocessing/resource_tracker.py:254: 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 '
(base) yunhai@192 stable-diffusion-webui-forge %

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the tensor-to-image conversion snippet and the LayerDiffuse generation path as entry points, reproducing the black outputs with the reported batch sizes on macOS MPS. Inspect the abort reported at webui.sh line 304; done means generation no longer produces black images or the MPS Axis = 4 fatal error.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.