From 08ed09d20bd8670bfa84e8dd3c113fce02ec4008 Mon Sep 17 00:00:00 2001 From: Patrice Vignola Date: Tue, 29 Nov 2022 18:57:52 -0800 Subject: [PATCH] Add DML support to the transformers benchmark.py script (#13776) ### Description Add DML support to the transformers benchmark.py script ### Motivation and Context Before this change, running the `benchmark.py` script when the `onnxruntime-directml` package is installed resulted in an error because it expects a CUDA or ROCM framework. --- onnxruntime/python/tools/transformers/benchmark.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/onnxruntime/python/tools/transformers/benchmark.py b/onnxruntime/python/tools/transformers/benchmark.py index 3979afc763..e3062d6ff7 100644 --- a/onnxruntime/python/tools/transformers/benchmark.py +++ b/onnxruntime/python/tools/transformers/benchmark.py @@ -118,9 +118,10 @@ def run_onnxruntime( use_gpu and ("CUDAExecutionProvider" not in onnxruntime.get_available_providers()) and ("ROCMExecutionProvider" not in onnxruntime.get_available_providers()) + and ("DmlExecutionProvider" not in onnxruntime.get_available_providers()) ): logger.error( - "Please install onnxruntime-gpu package instead of onnxruntime, and use a machine with GPU for testing gpu performance." + "Please install onnxruntime-gpu or onnxruntime-directml package instead of onnxruntime, and use a machine with GPU for testing gpu performance." ) return results