lllyasviel / stable-diffusion-webui-forge

GNU Affero General Public License v3.0
8.32k stars 808 forks source link

Lag in WebUI Forge #971

Open Robo798814 opened 2 months ago

Robo798814 commented 2 months ago

When using Webui Forge, I start experience lag within the tab itself, which doesn't affect my entire browser or system. Everything responds slower, including switching tabs within the Webui, etc. Generation speeds are not effected I believe. I also did not experience this issue in the original A1111, hence this post.

Here are my specs if relevant: i5-3570k GTX 1070 Ti 16gb

I will post more information if directed to.

KtuJis commented 2 months ago

Same, but for me everything slows down, opening tabs, minimizing the browser, opening other apps, etc. Eventually, after turning on the webui, everything goes back to normal. Slowdowns exactly during webui loading. When webui boots, the disk on which forge is installed is 100% loaded, as well as RAM is also loaded at 100%. this has not happened before, the load at 100% appeared ~week ago i5- 12400 16gb RAM rtx 3060

E2GO commented 2 months ago

Same when using inpainting and especially with big images. Foocus & ReForge works normal.

Specs: NVIDIA GeForce RTX 4090 Nvidia Drivers 560.70 CPU: 11th Gen Intel(R) Core(TM) i9-11900F @ 2.50GHz 63.88 GB RAM

Startup:

Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: f1.0.2v1.10.1-previous-192-g91f3f628
Commit hash: 91f3f628bd4aaa645e786110d5690de1f5bcd198
Launching Web UI with arguments: --xformers --always-gpu --disable-nan-check --cuda-stream --pin-shared-memory --ckpt-dir 'J:\Checkpoints' --clip-models-path 'J:\cachenew' --theme dark --embeddings-dir 'J:\A1111\stable-diffusion-webui\embeddings' --lora-dir 'J:\A1111\stable-diffusion-webui\models\Lora'
Total VRAM 24564 MB, total RAM 65414 MB
pytorch version: 2.1.2+cu121
WARNING:xformers:A matching Triton is not available, some optimizations will not be enabled.
Error caught was: No module named 'triton'
xformers version: 0.0.23.post1
Set vram state to: HIGH_VRAM
Always pin shared GPU memory
Device: cuda:0 NVIDIA GeForce RTX 4090 : native
Hint: your device supports --cuda-malloc for potential speed improvements.
VAE dtype preferences: [torch.bfloat16, torch.float32] -> torch.bfloat16
CUDA Stream Activated:  True
J:\webui_forge_cu121_torch21\system\python\lib\site-packages\transformers\utils\hub.py:127: FutureWarning: Using `TRANSFORMERS_CACHE` is deprecated and will be removed in v5 of Transformers. Use `HF_HOME` instead.
  warnings.warn(
Using xformers cross attention
Using xformers attention for VAE
ControlNet preprocessor location: J:\webui_forge_cu121_torch21\webui\models\ControlNetPreprocessor
[-] ADetailer initialized. version: 24.6.0, num models: 10
2024-08-08 22:42:53,113 - ControlNet - INFO - ControlNet UI callback registered.
Loading weights [2d122c9cb2] from J:\Checkpoints\ALL_SDXL\halcyonSDXL_v17.safetensors
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
StateDict Keys: {'unet': 1680, 'vae': 248, 'text_encoder': 197, 'text_encoder_2': 519, 'ignore': 0}
Startup time: 13.5s (prepare environment: 2.5s, launcher: 1.8s, import torch: 2.8s, other imports: 0.6s, load scripts: 2.3s, create ui: 2.0s, gradio launch: 1.2s).
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
K-Model Created: {'storage_dtype': torch.float8_e4m3fn, 'computation_dtype': torch.float16, 'manual_cast': True}
Model loaded in 7.1s (load weights from disk: 1.3s, forge model load: 5.3s, load VAE: 0.5s).
AdmiralAwsum commented 2 months ago

I have the same problem, no matter if I use Brave or Firefox. Brave Version 1.68.137 Chromium: 127.0.6533.100 (Official Build) (64-bit)

Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] Version: f1.0.2v1.10.1-previous-214-gdad1d17f Commit hash: dad1d17f15687dcd4eeaca7de88a35a1f4457f65 Collecting protobuf<=4.9999,>=4.25.3 Using cached protobuf-4.25.4-cp310-abi3-win_amd64.whl.metadata (541 bytes) Using cached protobuf-4.25.4-cp310-abi3-win_amd64.whl (413 kB) Installing collected packages: protobuf Attempting uninstall: protobuf Found existing installation: protobuf 3.20.0 Uninstalling protobuf-3.20.0: Successfully uninstalled protobuf-3.20.0 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. open-clip-torch 2.20.0 requires protobuf<4, but you have protobuf 4.25.4 which is incompatible. Successfully installed protobuf-4.25.4 C:\Users\Admiral Awesome\AppData\Roaming\StabilityMatrix\Packages\stable-diffusion-webui-forge\extensions-builtin\forge_legacy_preprocessors\install.py:2: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html import pkg_resources C:\Users\Admiral Awesome\AppData\Roaming\StabilityMatrix\Packages\stable-diffusion-webui-forge\extensions-builtin\sd_forge_controlnet\install.py:2: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html import pkg_resources Launching Web UI with arguments: --server-name powerhouse --enable-insecure-extension-access --theme dark --listen --gradio-allowed-path 'C:\Users\Admiral Awesome\AppData\Roaming\StabilityMatrix\Images' Total VRAM 11264 MB, total RAM 130972 MB pytorch version: 2.1.2+cu121 Set vram state to: NORMAL_VRAM Device: cuda:0 NVIDIA GeForce RTX 2080 Ti : native Hint: your device supports --pin-shared-memory for potential speed improvements. Hint: your device supports --cuda-malloc for potential speed improvements. Hint: your device supports --cuda-stream for potential speed improvements. VAE dtype preferences: [torch.float32] -> torch.float32 CUDA Using Stream: False Using pytorch cross attention Using pytorch attention for VAE ControlNet preprocessor location: C:\Users\Admiral Awesome\AppData\Roaming\StabilityMatrix\Packages\stable-diffusion-webui-forge\models\ControlNetPreprocessor [-] ADetailer initialized. version: 24.5.1, num models: 10 CivitAI Browser+: Aria2 RPC started 2024-08-10 08:45:49,600 - ControlNet - INFO - ControlNet UI callback registered. C:\Users\Admiral Awesome\AppData\Roaming\StabilityMatrix\Packages\stable-diffusion-webui-forge\extensions\sd-civitai-browser-plus\scripts\civitai_gui.py:204: GradioDeprecationWarning: unexpected argument for Button: label refresh = gr.Button(label="", value="", elem_id=refreshbtn, icon="placeholder") Loading parameters: {'checkpoint_info': {'filename': 'C:\Users\Admiral Awesome\AppData\Roaming\StabilityMatrix\Packages\stable-diffusion-webui-forge\models\Stable-diffusion\cyberrealisticSemi_v14.safetensors', 'hash': '6c0430f5'}, 'vae_filename': None, 'unet_storage_dtype': None} Running on local URL: http://localhost:7860

To create a public link, set share=True in launch(). Startup time: 42.5s (prepare environment: 13.1s, launcher: 5.6s, import torch: 7.1s, setup paths: 0.3s, initialize shared: 0.4s, other imports: 3.5s, list SD models: 0.1s, load scripts: 4.7s, initialize extra networks: 0.5s, create ui: 4.3s, gradio launch: 3.0s).

DrJimmyBrungus commented 2 months ago

Same here. I thought it might be due to the extensions I recently installed, but removing them makes no difference.

D-a-r-n-o-l-d commented 2 months ago

same but this happened only after i updated to the newest version

Robo798814 commented 2 months ago

It seems that this problem is most likely not caused by weak specs which @E2GO indirectly suggested. 🤔

ShajLaw commented 2 months ago

Same problem here, started a while ago after an update. Especially during inpainting of images larger than 1024x1024. Additionally, the same thing occurs when accessing the server via an external browser on another PC.

nor1c commented 2 months ago

Just moved from A1111 to Forge today, and this happened to me too 😢 Disabling almost all extensions fixed the issue but I need them qwq

leukophobia commented 2 months ago

I dont know if it is the same but I have similar problem. Even writing is slow and the characters appear late. Image generation is not slow but sometimes it is problematic at the start.

Malfrador commented 2 months ago

At least for me this was caused by the Civitai-Browser extension causing lots of animation frame requests every second, leading to lag especially on less powerful devices. This was very easily visible in the JS profiler.

Disabling that extension fixed the lag and also reduced JS heap usage from 200+ MB to just 40 MB. So maybe check if you have that extension and try disabling it, this does not seem to be an issue with webui itself.

DrJimmyBrungus commented 2 months ago

At least for me this was caused by the Civitai-Browser extension causing lots of animation frame requests every second, leading to lag especially on less powerful devices. This was very easily visible in the JS profiler.

Disabling that extension fixed the lag and also reduced JS heap usage from 200+ MB to just 40 MB. So maybe check if you have that extension and try disabling it, this does not seem to be an issue with webui itself.

This made me go back and check my own extensions again. While I don't have the mentioned Civitai Browser, I do have a completely different one called Images Browser (which I thought I disabled along with the others, but I guess not).

I can confirm disabling this extention fixed the issue. Turned it on/off a few times to make sure.

I guess there's something shared between these extensions that is causing issues?

younyokel commented 2 months ago

Confirming turning off CivitAi Browser helped

nor1c commented 2 months ago

This made me go back and check my own extensions again. While I don't have the mentioned Civitai Browser, I do have a completely different one called Images Browser (which I thought I disabled along with the others, but I guess not).

I can confirm disabling this extention fixed the issue. Turned it on/off a few times to make sure.

I guess there's something shared between these extensions that is causing issues?

Update your extension, it has been fixed on this commit: https://github.com/AlUlkesh/stable-diffusion-webui-images-browser/commit/746fbffdaeb664c7aa100299be77fc5eafee061e

https://github.com/AlUlkesh/stable-diffusion-webui-images-browser/issues/258

jenya13370 commented 2 months ago

At least for me this was caused by the Civitai-Browser extension causing lots of animation frame requests every second, leading to lag especially on less powerful devices. This was very easily visible in the JS profiler.

Disabling that extension fixed the lag and also reduced JS heap usage from 200+ MB to just 40 MB. So maybe check if you have that extension and try disabling it, this does not seem to be an issue with webui itself.

thanks, it's helped