AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: Multiple simultaneous users breaks multi-model/checkpoint #9125

Open Ravstar225 opened 1 year ago

Ravstar225 commented 1 year ago

Is there an existing issue for this?

What happened?

When multiple users are using the same backend, there is no check that the image being generated is using the model/checkpoint currently selected by the user.

Steps to reproduce the problem

  1. Open the automatic 1111 webui in 2 different browsers
  2. Choose two different checkpoints in each window
  3. Click generate on both, they will generate using the model last selected

What should have happened?

The frontend should send the current model selected with the generate request to the backend, which should check if it matches the backend currently loaded, and if it doesn't, it should change to the backend selected so the image generated always matches whatever checkpoint is selected.

Commit where the problem happens

https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/3856ada5cc9ac4124e20ff311ce7aa77330845d9

What platforms do you use to access the UI ?

Windows, Linux, MacOS

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

--xformers --listen --port 6969 --disable-nan-check

List of extensions

sd-webui-controlnet sd-webui-additional-networks

Console logs

remote: Enumerating objects: 121, done.
remote: Counting objects: 100% (97/97), done.
Receiving objects:  98% (119/121)sed 97 (delta 97), pack-reused 24
Receiving objects: 100% (121/121), 71.17 KiB | 1.87 MiB/s, done.
Resolving deltas: 100% (97/97), completed with 37 local objects.
From https://github.com/AUTOMATIC1111/stable-diffusion-webui
   955df775..3856ada5  master           -> origin/master
 * [new branch]        img2img-scale-by -> origin/img2img-scale-by
Updating 955df775..3856ada5
Fast-forward
 javascript/extensions.js              |   6 +--
 launch.py                             |   6 ++-
 models/karlo/ViT-L-14_stats.th        | Bin 0 -> 7079 bytes
 modules/extensions.py                 |  13 +++++-
 modules/hypernetworks/hypernetwork.py |   2 +-
 modules/img2img.py                    |   3 +-
 modules/lowvram.py                    |  10 +++--
 modules/processing.py                 |  41 +++++++++++++------
 modules/sd_models.py                  |  10 ++++-
 modules/sd_models_config.py           |   7 ++++
 modules/sd_samplers_compvis.py        |  31 ++++++++++----
 modules/sd_samplers_kdiffusion.py     |  19 ++++++---
 modules/shared.py                     |   3 +-
 modules/ui.py                         |  74 +++++++++++++++++++---------------
 modules/ui_extensions.py              |  21 ++++++++--
 style.css                             |   8 ++++
 16 files changed, 178 insertions(+), 76 deletions(-)
 create mode 100644 models/karlo/ViT-L-14_stats.th
venv "D:\Stable-diffsion-webgui real\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Commit hash: 3856ada5cc9ac4124e20ff311ce7aa77330845d9
Fetching updates for Stable Diffusion...
Checking out commit for Stable Diffusion with hash: cf1d67a6fd5ea1aa600c4df58e5b47da45f6bdbf...
Installing requirements for Web UI
Installing requirement for sd-webui-controlnet

Launching Web UI with arguments: --xformers --listen --port 6969 --disable-nan-check
D:\Stable-diffsion-webgui real\venv\lib\site-packages\torchvision\transforms\functional_tensor.py:5: UserWarning: The torchvision.transforms.functional_tensor module is deprecated in 0.15 and will be **removed in 0.17**. Please don't rely on it. You probably just need to use APIs in torchvision.transforms.functional or in torchvision.transforms.v2.functional.
  warnings.warn(
[AddNet] Updating model hashes...
100%|████████████████████████████████████████████████████████████████████████████████| 18/18 [00:00<00:00, 3597.69it/s]
[AddNet] Updating model hashes...
100%|████████████████████████████████████████████████████████████████████████████████| 18/18 [00:00<00:00, 4376.41it/s]
Loading weights [fc2511737a] from D:\Stable-diffsion-webgui real\models\Stable-diffusion\chilloutmix_NiPrunedFp32Fix.safetensors
Creating model from config: D:\Stable-diffsion-webgui real\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(0):
Textual inversion embeddings skipped(3): nartfixer, nfixer, nrealfixer
Model loaded in 3.6s (load weights from disk: 0.2s, create model: 0.4s, apply weights to model: 0.5s, apply half(): 0.5s, move model to device: 0.7s, load textual inversion embeddings: 1.3s).
Running on local URL:  http://0.0.0.0:6969

To create a public link, set `share=True` in `launch()`.
Startup time: 31.0s (import torch: 3.3s, import gradio: 2.2s, import ldm: 1.1s, other imports: 2.5s, setup codeformer: 0.1s, load scripts: 2.2s, load SD checkpoint: 3.9s, create ui: 11.5s, gradio launch: 4.2s).
Loading weights [b81fbf83d0] from D:\Stable-diffsion-webgui real\models\Stable-diffusion\pixhell_v10.safetensors
Creating model from config: D:\Stable-diffsion-webgui real\repositories\stable-diffusion-stability-ai\configs\stable-diffusion\v2-inference-v.yaml
LatentDiffusion: Running in v-prediction mode
DiffusionWrapper has 865.91 M params.
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(3): nartfixer, nfixer, nrealfixer
Model loaded in 5.0s (find config: 0.9s, create model: 0.2s, apply weights to model: 2.3s, apply half(): 0.7s, move model to device: 0.8s).
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:06<00:00,  2.98it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 20/20 [00:00<00:00, 20.39it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 19.61it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 20/20 [00:00<00:00, 20.74it/s]
Loading weights [db2c51c333] from D:\Stable-diffsion-webgui real\models\Stable-diffusion\dreamshaper_4BakedVaeFp16.safetensors
Creating model from config: D:\Stable-diffsion-webgui real\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(0):
Textual inversion embeddings skipped(3): nartfixer, nfixer, nrealfixer
Model loaded in 6.0s (create model: 0.3s, apply weights to model: 4.5s, apply half(): 0.5s, move model to device: 0.6s).
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 14.18it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 18.18it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 19.13it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 20/20 [00:00<00:00, 20.11it/s]
Loading weights [1254103966] from D:\Stable-diffsion-webgui real\models\Stable-diffusion\protogenV22Anime_22.safetensors
Applying xformers cross attention optimization.
Weights loaded in 45.1s (load weights from disk: 0.4s, apply weights to model: 44.2s, move model to device: 0.4s).
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 14.66it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 20/20 [00:00<00:00, 20.36it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:00<00:00, 23.15it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 20/20 [00:00<00:00, 20.61it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 20/20 [00:00<00:00, 23.99it/s]

Additional information

No response

missionfloyd commented 1 year ago

Yeah, that'll happen. It's not designed for multiple users.

WellTung666 commented 1 year ago

I also encountered the same problem, did you solve it?

bboyban commented 1 year ago

I also have this problem and I hope it can be resolved