Open
Description
Describe the issue
I attempted to execute the MobileNet model using the ONNX Runtime with the QNN execution provider on a CPU, specifying 'CPUExecutionProvider' as the execution provider option. However, the InferenceSession frequently crashes during its creation when running the same script.
To reproduce
I tried to execute the mobilenet model using below script:
import onnxruntime as ort
import numpy as np
import time
import io_utils
execution_provider_option = {"backend_path": "QnnCpu.dll"}
#Create ONNX Runtime session.
onnx_model_path = "./mobilenet_v2.onnx"
session = ort.InferenceSession(onnx_model_path,
providers=["QNNExecutionProvider"],
provider_options=[execution_provider_option])
#Step2: Input/Output handling, Generate raw input
#github repo for below artifact: https://github.com/quic/wos-ai/tree/main/Artifacts
img_path = "https://raw.githubusercontent.com/quic/wos-ai/refs/heads/main/Artifacts/kitten.jpg"
raw_img = io_utils.preprocess(img_path)
#Model input and output names
outputs = session.get_outputs()[0].name
inputs = session.get_inputs()[0].name
#Step3: Model inferencing using preprocessed input.
start_time = time.time()
for i in range(10):
prediction = session.run([outputs], {inputs: raw_img})
end_time = time.time()
execution_time = ((end_time-start_time) * 1000)/10
#Step4: Output postprocessing
io_utils.postprocess(prediction)
print("Execution Time: ", execution_time, "ms")
This script and necessary setup instructions can be found here- https://docs.qualcomm.com/bundle/publicresource/topics/80-62010-1/ort-qnn-ep.html?product=1601111740057789
Urgency
It is very urgent.
Platform
Windows
OS Version
11
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
onnxruntime-qnn 1.21.0
ONNX Runtime API
Python
Architecture
ARM64
Execution Provider
QNN
Execution Provider Library Version
QNN 2.31.0.250130