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

Use GPU for WD tagger models (if available) #297

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vvern999
Copy link

@vvern999 vvern999 commented Nov 3, 2024

ONNX defaults to using only CPU if these packages are not installed, which is slow.
It needs onnxruntime-directml package on windows or onnxruntime-gpu on linux

Performance (SmilingWolf/wd-eva02-large-tagger-v3)
default (cpu):

Finished captioning 100 images in 3.1 minutes (1.8 s/image)

with directml:

Finished captioning 100 images in 19.2 seconds (0.2 s/image)

@@ -34,6 +34,7 @@ numpy==1.26.4
# WD Tagger
huggingface-hub==0.26.2
onnxruntime==1.19.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered swapping this to onnxruntime-gpu? Maybe for platform_system == "Linux" only?

@@ -34,6 +34,7 @@ numpy==1.26.4
# WD Tagger
huggingface-hub==0.26.2
onnxruntime==1.19.2
onnxruntime-directml==1.19.2; platform_system == "Windows"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you have onnxruntime and onnxruntime-directml installed at the same time? I've found that onnxruntime and onnxruntime-gpu seem to be mutually exclusive; the CPU version took precedent over the GPU version when performing Onnx tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants