lllyasviel / lllyasviel/stable-diffusion-webui-forge

[Bug]: Turbo/SGMUniform + batch size generates different outcome with the same seed

Open
#546 5 comments 1 reaction 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

### Checklist

- [X] The issue exists after disabling all extensions
- [X] The issue exists on a clean installation of webui
- [ ] The issue is caused by an extension, but I believe it is caused by a bug in the webui
- [X] The issue exists in the current version of the webui
- [X] The issue has not been reported before recently
- [ ] The issue has been reported before but has not been fixed yet

### What happened?

So, if I use any of the turbo or SGMUniform sampling methods and I use a batch size it will mess with the seed, here's an example:

Seed: 1, batch size 2, Euler A Turbo
This will give me 2 images with seed 1 and seed 2 (no prompt)
![image](https://github.com/lllyasviel/stable-diffusion-webui-forge/assets/12915302/f40e5681-d650-4ded-806b-4cbe6994e438)

And then Seed: 2, batch size 1, Euler A Turbo
This should give me the 2nd image (the colorful one)
![image](https://github.com/lllyasviel/stable-diffusion-webui-forge/assets/12915302/4a56fc48-1bdb-44f1-8694-3984a0759d7a)

And they are often quite close, its as if the seed is one off but its the same seed... the PNG info is the same
![02267-aamXLAnimeMix_v10HalfturboEulera-Euler A Turbo](https://github.com/lllyasviel/stable-diffusion-webui-forge/assets/12915302/63ce0826-6bcf-4481-8224-abc3359d452a)
![02270-aamXLAnimeMix_v10HalfturboEulera-Euler A Turbo](https://github.com/lllyasviel/stable-diffusion-webui-forge/assets/12915302/2c24857f-1b67-4053-a295-8fdfab52795a)

### Steps to reproduce the problem

Easy test:
![image](https://github.com/lllyasviel/stable-diffusion-webui-forge/assets/12915302/85662586-9f81-4a48-8282-1746cf3b7dd8)

### What should have happened?

The 2nd image should've been the same since its the same seed

### What browsers do you use to access the UI ?

Google Chrome

### Sysinfo

[sysinfo-2024-03-12-20-53.json](https://github.com/lllyasviel/stable-diffusion-webui-forge/files/14578560/sysinfo-2024-03-12-20-53.json)

### Console logs

```Shell
2024-03-12 21:56:34,706 - ControlNet - INFO - ControlNet UI callback registered.
Running on local URL: http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
model_type EPS
UNet ADM Dimension 2816
Startup time: 7.8s (prepare environment: 1.7s, import torch: 2.1s, import gradio: 0.6s, setup paths: 0.5s, other imports: 0.3s, load scripts: 1.2s, create ui: 0.4s, gradio launch: 1.0s).
Using pytorch attention in VAE
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
Using pytorch attention in VAE
extra {'cond_stage_model.clip_g.transformer.text_model.embeddings.position_ids', 'cond_stage_model.clip_l.text_projection', 'cond_stage_model.clip_l.transformer.text_model.embeddings.position_ids', 'cond_stage_model.clip_l.logit_scale'}
left over keys: dict_keys(['conditioner.embedders.0.logit_scale', 'conditioner.embedders.0.text_projection'])
To load target model SDXLClipModel
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) = 9072.99609375
[Memory Management] Model Memory (MB) = 2144.3546981811523
[Memory Management] Minimal Inference Memory (MB) = 1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) = 5904.641395568848
Moving model(s) has taken 0.40 seconds
Model loaded in 4.5s (load weights from disk: 0.5s, forge instantiate config: 0.8s, forge load real models: 2.3s, load VAE: 0.3s, calculate empty prompt: 0.5s).
To load target model SDXL
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) = 9016.80712890625
[Memory Management] Model Memory (MB) = 4897.086494445801
[Memory Management] Minimal Inference Memory (MB) = 1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) = 3095.720634460449
Moving model(s) has taken 1.34 seconds
100%|████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:01<00:00, 4.51it/s]
To load target model AutoencoderKL███████████████████████████████████████████████████████| 5/5 [00:00<00:00, 6.16it/s]
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) = 4012.14990234375
[Memory Management] Model Memory (MB) = 159.55708122253418
[Memory Management] Minimal Inference Memory (MB) = 1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) = 2828.592821121216
Moving model(s) has taken 0.06 seconds
Total progress: 100%|████████████████████████████████████████████████████████████████████| 5/5 [00:01<00:00, 3.17it/s]
To load target model SDXLClipModel███████████████████████████████████████████████████████| 5/5 [00:01<00:00, 6.16it/s]
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) = 3838.0810546875
[Memory Management] Model Memory (MB) = 2144.3546981811523
[Memory Management] Minimal Inference Memory (MB) = 1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) = 669.7263565063477
Moving model(s) has taken 0.44 seconds
100%|████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 8.16it/s]
Total progress: 100%|████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 7.40it/s]
Total progress: 100%|████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 11.45it/s]
```

### Additional information

_No response_

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

Reproduce the discrepancy with Turbo or SGMUniform sampling using batch sizes 1 and 2, keeping the seed and prompt settings from the report. Start at the sampling and batch-seed handling entry points; done means the second image from a batch matches a separate run with that image's seed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
ai, 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.