Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: ADetailer locks available CPU threads to 8 after running the script once #747

Open
ChiNoel-osu opened this issue Dec 3, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ChiNoel-osu
Copy link

Describe the bug

sd-webui is ran in CPU only mode:

export COMMANDLINE_ARGS="--no-download-sd-model --listen --enable-console-prompts --enable-insecure-extension-access --use-cpu all --precision autocast --no-half --skip-torch-cuda-test"
export CUDA_VISIBLE_DEVICES="-1"
export OMP_NUM_THREADS=24
export MKL_NUM_THREADS=24

Inference without enabling the ADetailer script will use 24 threads every time.

When ADetailer script is enabled in this session, the first pass (where it generates with original prompts and settings) of the first generated image will use 24 threads, the "ADetailer" pass (where it masks the generated image and inpaints it) will only use 8 threads. All subsequent inferences will only use 8 threads from now on, even if I disable ADetailer.

Steps to reproduce

  1. Have a CPU that has more than 8 threads
  2. Launch webui in CPU only mode
  3. Generate any image w/ ADetailer script
  4. Observe the CPU usage during each pass

Screenshots

No response

Console logs, from start to end.

Python 3.10.12 (main, Nov  6 2024, 20:22:13) [GCC 11.4.0]
Version: v1.10.1
Commit hash: 82a973c04367123ae98bd9abdf80d9eda9b910e2
ControlNet init warning: Unable to install insightface automatically. Please try run `pip install insightface` manually.
Launching Web UI with arguments: --no-download-sd-model --listen --enable-console-prompts --enable-insecure-extension-access --use-cpu all --precision autocast --no-half --skip-torch-cuda-test
No module 'xformers'. Proceeding without it.
Warning: caught exception 'No CUDA GPUs are available', memory monitor disabled
[-] ADetailer initialized. version: 24.11.1, num models: 10
....(Everything is normal with no exceptions)

List of installed extensions

adetailer
tagcomplete
dynamic prompt
controlnet
webui-state

@ChiNoel-osu ChiNoel-osu added the bug Something isn't working label Dec 3, 2024
@Bing-su
Copy link
Owner

Bing-su commented Dec 5, 2024

This is a problem I never imagined. Please let me know what hardware and software version you're using and I'll give it a try.

Also, since there was a supply chain attack on the ultralytics package, please make sure you're not using version 8.3.41 of ultralytics.

@ChiNoel-osu
Copy link
Author

ChiNoel-osu commented Dec 6, 2024

Using the latest version of both SDWebUI (82a973c) and adetailer (v24.11.1).
The CPU is an Intel Xeon w7-3455 (24C48T), but I think any CPU with more than 8 cores should be able to reproduce this problem.

ultralytics 8.3.19
ultralytics-thop 2.0.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants