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

ValueError: This ORT build has... #5

Open
hashnag opened this issue Sep 3, 2023 · 0 comments
Open

ValueError: This ORT build has... #5

hashnag opened this issue Sep 3, 2023 · 0 comments

Comments

@hashnag
Copy link

hashnag commented Sep 3, 2023

Running Ubuntu 22.04 LTS I get the following error:

Traceback (most recent call last): File "/home/user/GFPGAN-onnxruntime-demo/torch2onnx.py", line 67, in <module> ort_session = onnxruntime.InferenceSession(onnx_model_path) File "/home/user/miniconda3/envs/richard-roop/lib/python3.10/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 396, in __init__ raise e File "/home/user/miniconda3/envs/richard-roop/lib/python3.10/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 383, in __init__ self._create_inference_session(providers, provider_options, disabled_optimizers) File "/home/user/miniconda3/envs/richard-roop/lib/python3.10/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 415, in _create_inference_session raise ValueError( ValueError: This ORT build has ['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider'] enabled. Since ORT 1.9, you are required to explicitly set the providers parameter when instantiating InferenceSession. For example, onnxruntime.InferenceSession(..., providers=['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider'], ...)

To fix the issue I modify line 67 in torch2onnx.py:

From:
ort_session = onnxruntime.InferenceSession(onnx_model_path)

To:
ort_session = onnxruntime.InferenceSession(onnx_model_path, providers=['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider'])

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

No branches or pull requests

1 participant