AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
139.48k stars 26.44k forks source link

[Bug]: Web UI slows down generation in img2img (Firefox only?) #11699

Open gengel opened 1 year ago

gengel commented 1 year ago

Is there an existing issue for this?

What happened?

When running generations on the img2img tab, performance becomes very slow, much slower than txt2img for similarly sized images -- unless I change tabs (in my browser) so that img2img and automatic1111 is no longer in focus. Then generation performs at normal expected rate.

Seems to happen in Firefox, but not Chrome.

Browser: Firefox OS: Windows Python: 3.10

Steps to reproduce the problem

  1. Go to img2img
  2. Upload an image
  3. Click Generate
  4. Wait (a long time)

Steps to Avoid the Problem

  1. Go to img2img
  2. Upload an image
  3. Glick Generate
  4. Change to any other tab in Firefox so that Automatic1111 is not shown
  5. Wait (a few seconds)

OR

What should have happened?

  1. Go to img2img
  2. Upload an image
  3. Click Generate
  4. Wait (a few seconds)

Version or Commit where the problem happens

1.4.0

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

Windows

What device are you running WebUI on?

Nvidia GPUs (GTX 16 below)

Cross attention optimization

Automatic

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

N/A

List of extensions

No

Console logs

Installing requirements

#######################################################################################################
Initializing Dreambooth
If submitting an issue on github, please provide the below text for debugging purposes:

Python revision: 3.10.7 (tags/v3.10.7:6cc6b13, Sep  5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)]
Dreambooth revision: 9f4d931a319056c537d24669cb950d146d1537b0
SD-WebUI revision: 394ffa7b0a7fff3ec484bcd084e673a8b301ccc8

Checking Dreambooth requirements...
[+] bitsandbytes version 0.35.0 installed.
[+] diffusers version 0.10.2 installed.
[+] transformers version 4.25.1 installed.
[ ] xformers version N/A installed.
[+] torch version 2.0.1+cu118 installed.
[+] torchvision version 0.15.2+cu118 installed.

#######################################################################################################

Launching Web UI with arguments: --reinstall-torch
No module 'xformers'. Proceeding without it.
SD-Webui API layer loaded

---
Loading weights [52484e6845] from C:\Users\lobot\scratch\stable-diffusion-webui\models\Stable-diffusion\epicrealism_pureEvolutionV3.safetensors
Creating model from config: C:\Users\lobot\scratch\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying attention optimization: Doggettx... done.
Model loaded in 22.0s (load weights from disk: 15.5s, load config: 0.1s, create model: 3.7s, apply weights to model: 0.8s, apply half(): 0.8s, move model to device: 0.9s).

---
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 46.2s (import torch: 7.8s, import gradio: 1.1s, import ldm: 0.7s, other imports: 2.2s, setup codeformer: 0.1s, list SD models: 0.3s, load scripts: 3.1s, create ui: 30.5s, gradio launch: 0.2s).
preload_extensions_git_metadata for 16 extensions took 4.61s
100%|██████████████████████████████████████████████████████████████████████████████████| 15/15 [01:06<00:00,  4.45s/it]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 15/15 [00:49<00:00,  3.31s/it]
100%|██████████████████████████████████████████████████████████████████████████████████| 15/15 [00:46<00:00,  3.11s/it]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 15/15 [00:45<00:00,  3.01s/it]
 13%|███████████                                                                        | 2/15 [02:13<16:57, 78.29s/it]
Total progress:  13%|████████▉                                                          | 2/15 [02:10<14:11, 65.49s/it]

Additional information

No response

Smackdab69 commented 1 year ago

I'm having this same issue. Just generating 2 images in 1024 resolution is taking 30+ minutes now.

I am running brave browser, for what it's worth. Can provide more env details if required.

dhwz commented 1 year ago

Not a "Bug".

Disable hardware acceleration in Firefox and try again. If you have your browser in focus the hardware acceleration will block the GPU partially and slows down the SD processing.

In Firefox:

  1. Click on Menu > Settings > General
  2. Scroll down until you see Performance, uncheck ‘Use recommended Performance Settings‘
  3. Then further, uncheck ‘ Use hardware acceleration when available.
gengel commented 1 year ago

Disabling hardware acceleration improves the issue, but everything still runs faster if I tab away from the Auto1111 view to literally any other webpage. I still feel like there's something happening on the Auto1111 screen that's triggering this.

KondratokGK commented 2 months ago

Same issue. firefox 127.0-1. It uses about 100% of cpu when automatic1111 generate image