stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

add task manager

Open wkpark opened this issue 1 year ago • 0 comments

based on https://github.com/lllyasviel/stable-diffusion-webui-forge/blob/main/modules_forge/main_thread.py

original author's comment in the source code:

This file is the main thread that handles all gradio calls for major t2i or i2i processing. Other gradio calls (like those from extensions) are not influenced. By using one single thread to process all major calls, model moving is significantly faster.

and it's commit: https://github.com/lllyasviel/stable-diffusion-webui-forge/commit/f06ba8e60b7a6c0a18979b2b7f2bc4aed68715d0

from commit message:

original author said: This will move all major gradio calls into the main thread rather than random gradio threads. This ensures that all torch.module.to() are performed in main thread to completely possible avoid GPU fragments. In my test now model moving is 0.7 ~ 1.2 seconds faster, which means all 6GB/8GB VRAM users will get 0.7 ~ 1.2 seconds faster per image on SDXL.

  • [x] classified
  • [x] fix workflow (~~all tests have been passed but coverage not work~~)
  • this way, gc.collect() will work as expected

extracted from PR #16484

wkpark avatar Oct 20 '24 06:10 wkpark