[BUG] AvgOnnxLatency blows up if you have installed multiple Onnx RuntimeProviders
lovettchris opened this issue · 0 comments
Describe the bug
The AvgOnnLatency
evaluator creates an OnnxRuntime InferenceSession
and InferenceSession requires that you specify the runtime provider when multiple are available, otherwise it throws an error.
To Reproduce
Steps to reproduce the behavior:
- Install multiple OnnxRuntime providers (eg. CPU and CUDA).
- Run this code:
import onnxruntime as rt
onnx_session = rt.InferenceSession('model.onnx')
- See error
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'], ...)
Expected behavior
AvgOnnLatency
should allow me to specify which device to use like this: e = AvgOnnLatency(device='gpu')
.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. Ubuntu Linux]
- Virtual Environment [e.g. conda, venv]
- Python Version [e.g. 3.7]
Additional context
Add any other context about the problem here.