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

onnxruntime-gpu but GPU dependencies are not loaded #1402

Closed
SuperSecureHuman opened this issue Sep 21, 2023 · 4 comments
Closed

onnxruntime-gpu but GPU dependencies are not loaded #1402

SuperSecureHuman opened this issue Sep 21, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@SuperSecureHuman
Copy link

SuperSecureHuman commented Sep 21, 2023

System Info

Optimum 1.13.1
Python 3.9


pip list | grep onnx                                                                                                                                                                                                                                          
onnx                      1.14.1
onnxruntime-gpu           1.16.0

Who can help?

@JingyaHuang @ech

Reproduction (minimal, reproducible, runnable)

Trying to use ORT with CUDA raises error -

onnxruntime-gpu is installed, but GPU dependencies are not loaded. It is likely there is a conflicting install between onnxruntime and onnxruntime-gpu. Please install only onnxruntime-gpu in order to use CUDAExecutionProvider."

While

image

Clearly, only ort-gpu is installed

Same issue can be reproduced in colab

%pip install optimum[onnxruntime-gpu]

ORTModelForSeq2SeqLM.from_pretrained(.... providers=["CUDAExecutionProvider"], use_io_binding=True)

Expected behavior

No error, expecting to run ort pipeline on GPU.

Workaround

Currently I am commenting out

def validate_provider_availability(provider: str):

Now the pipeline runs on GPU without any issues

@SuperSecureHuman SuperSecureHuman added the bug Something isn't working label Sep 21, 2023
@fxmarty
Copy link
Contributor

fxmarty commented Sep 21, 2023

Thank you @SuperSecureHuman, I can reproduce the issue. It appears onnxruntime-gpu==1.16.0 does not fill _ld_preload.py like it used to. I will patch!

@SuperSecureHuman
Copy link
Author

I am not very familiar with onnx internals.

But from my understanding, if something is there in the available providers, it should work right?

Why is the check needed?

@fxmarty
Copy link
Contributor

fxmarty commented Sep 21, 2023

The check is "needed" because ORT falls back to CPUExecutionProvider without any error in case the CUDA / TRT install is wrong (or in case onnxruntime was installed after onnxruntime-gpu), see: https://onnxruntime.ai/docs/execution-providers/#use-execution-providers. We had a few issues where users were confused because of this (e.g. ORT was using CPU EP although specifying CUDAExecutionProvider, or failing although onnxruntime-gpu was installed due to a double onnxruntime/onnxruntime-gpu install, etc.) so I implemented hard checks with meaningful errors.

For the record, here is how onnxruntime/capi/_ld_preload.py used to look like with onnxruntime-gpu<=1.15.1 (while empty for onnxruntime). It appears ORT 1.16.0 changed this.
image

Fixed in #1403, will publish a patch today!

@SuperSecureHuman
Copy link
Author

Got it!

Thanks!

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