gemma-2-9b-it-ONNX-DirectML-GenAI-INT4 / dml-device-specific-optim.py
zamroni111's picture
Upload 2 files
0bf203c verified
raw
history blame contribute delete
545 Bytes
import onnxruntime as rt
sess_options = rt.SessionOptions()
sess_options.graph_optimization_level = rt.GraphOptimizationLevel.ORT_ENABLE_ALL
#########################################
## Change the Path Accordingly
sess_options.optimized_model_filepath = "optimized_model.onnx"
#########################################
## Change the model.onnx path accordingly
session = rt.InferenceSession("model.onnx" , sess_options,
###providers=['xxxxxxxxxDmlExecutionProvider', 'CPUExecutionProvider'])
providers=['DmlExecutionProvider'])