From 5294cd0c55eee7de6cff790258a00c73354244cb Mon Sep 17 00:00:00 2001 From: Hariharan Seshadri Date: Tue, 4 Apr 2023 16:01:24 -0700 Subject: [PATCH] Print value errors in ort.InferenceSession to user (#15360) --- onnxruntime/python/onnxruntime_inference_collection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/onnxruntime/python/onnxruntime_inference_collection.py b/onnxruntime/python/onnxruntime_inference_collection.py index efdea4fb1f..7a387abb3b 100644 --- a/onnxruntime/python/onnxruntime_inference_collection.py +++ b/onnxruntime/python/onnxruntime_inference_collection.py @@ -367,9 +367,9 @@ class InferenceSession(Session): try: self._create_inference_session(providers, provider_options, disabled_optimizers) - except ValueError: + except ValueError as e: if self._enable_fallback: - print(f"EP Error using {providers}") + print(f"EP Error {e} when using {providers}") print(f"Falling back to {self._fallback_providers} and retrying.") self._create_inference_session(self._fallback_providers, None) # Fallback only once.