Open jikechao opened 11 months ago
@jikechao the provided ONNX model executes fine while using the benchmark_app on OpenVINO 2023.2 (see below), please double check the code snippet you've provided. Check the Inference Pipeline documentation for reference.
$ benchmark_app -m dropout.onnx -d CPU -niter 1000
[Step 1/11] Parsing and validating input arguments
[ INFO ] Parsing input parameters
[Step 2/11] Loading OpenVINO Runtime
[ INFO ] OpenVINO:
[ INFO ] Build ................................. 2023.2.0-13089-cfd42bd2cb0-HEAD
[ INFO ]
[ INFO ] Device info:
[ INFO ] CPU
[ INFO ] Build ................................. 2023.2.0-13089-cfd42bd2cb0-HEAD
[ INFO ]
[ INFO ]
[Step 3/11] Setting device configuration
[ WARNING ] Performance hint was not explicitly specified in command line. Device(CPU) performance hint will be set to PerformanceMode.THROUGHPUT.
[Step 4/11] Reading model files
[ INFO ] Loading model files
[ INFO ] Read model took 7.45 ms
[ INFO ] Original model I/O parameters:
[ INFO ] Model inputs:
[ INFO ] y (node: y) : f32 / [...] / [3,4,5]
[ INFO ] Model outputs:
[ INFO ] y (node: y) : f32 / [...] / [3,4,5]
[Step 5/11] Resizing model to match image sizes and given batch
[ INFO ] Model batch size: 1
[Step 6/11] Configuring input of the model
[ INFO ] Model inputs:
[ INFO ] y (node: y) : u8 / [C,H,W] / [3,4,5]
[ INFO ] Model outputs:
[ INFO ] ***NO_NAME*** (node: Convert_4) : f32 / [...] / [3,4,5]
[Step 7/11] Loading the model to the device
[ INFO ] Compile model took 7.32 ms
[Step 8/11] Querying optimal runtime parameters
[ INFO ] Model:
[ INFO ] NETWORK_NAME: Dropout
[ INFO ] OPTIMAL_NUMBER_OF_INFER_REQUESTS: 4
[ INFO ] NUM_STREAMS: 4
[ INFO ] AFFINITY: Affinity.CORE
[ INFO ] INFERENCE_NUM_THREADS: 8
[ INFO ] PERF_COUNT: False
[ INFO ] INFERENCE_PRECISION_HINT: <Type: 'float32'>
[ INFO ] PERFORMANCE_HINT: PerformanceMode.THROUGHPUT
[ INFO ] EXECUTION_MODE_HINT: ExecutionMode.PERFORMANCE
[ INFO ] PERFORMANCE_HINT_NUM_REQUESTS: 0
[ INFO ] ENABLE_CPU_PINNING: True
[ INFO ] SCHEDULING_CORE_TYPE: SchedulingCoreType.ANY_CORE
[ INFO ] ENABLE_HYPER_THREADING: True
[ INFO ] EXECUTION_DEVICES: ['CPU']
[ INFO ] CPU_DENORMALS_OPTIMIZATION: False
[ INFO ] CPU_SPARSE_WEIGHTS_DECOMPRESSION_RATE: 1.0
[Step 9/11] Creating infer requests and preparing input tensors
[ WARNING ] No input files were given for input 'y'!. This input will be filled with random values!
[ INFO ] Fill input 'y' with random values
[Step 10/11] Measuring performance (Start inference asynchronously, 4 inference requests, limits: 1000 iterations)
[ INFO ] Benchmarking in inference only mode (inputs filling are not included in measurement loop).
[ INFO ] First inference took 0.13 ms
[Step 11/11] Dumping statistics report
[ INFO ] Execution Devices:['CPU']
[ INFO ] Count: 1000 iterations
[ INFO ] Duration: 19.88 ms
[ INFO ] Latency:
[ INFO ] Median: 0.02 ms
[ INFO ] Average: 0.03 ms
[ INFO ] Min: 0.01 ms
[ INFO ] Max: 10.24 ms
[ INFO ] Throughput: 50311.93 FPS
Hi @avitial, I updated the OpenVINO version to 2024.0.0-13874-d7ba44f8c38
, Crash still occurred。
BTW, what does the command benchmark_app
refer to?
@jikechao the benchmark_app refers to the Benchmark Python Tool used to estimate deep learning inference performance on supported devices. This tool is automatically installed when you install OpenVINO Developer Tools using PyPI, check the docs for more info.
@jikechao I see that the issue lies in translation where Dropout layer just got disappeared and model just contains result node and x input indeed missing.
IR file:
<?xml version="1.0"?>
<net name="Dropout" version="11">
<layers>
<layer id="0" name="y" type="Parameter" version="opset1">
<data shape="3,4,5" element_type="f32" />
<output>
<port id="0" precision="FP32" names="y">
<dim>3</dim>
<dim>4</dim>
<dim>5</dim>
</port>
</output>
</layer>
<layer id="1" name="y/sink_port_0" type="Result" version="opset1">
<input>
<port id="0" precision="FP32">
<dim>3</dim>
<dim>4</dim>
<dim>5</dim>
</port>
</input>
</layer>
</layers>
<edges>
<edge from-layer="0" from-port="0" to-layer="1" to-port="0" />
</edges>
<rt_info />
</net>
ONNX infer script:
import onnxruntime as rt
import numpy as np
sess = rt.InferenceSession("dropout.onnx")
input= np.ndarray([3, 4, 5], dtype=np.single)
sess.run([], {'x': input})
Legacy MO ONNX which can translate this op to Identity and input survives:
<layers>
<layer id="0" name="x" type="Parameter" version="opset1">
<data shape="3,4,5" element_type="f32" />
<output>
<port id="0" precision="FP32" names="x,x:0">
<dim>3</dim>
<dim>4</dim>
<dim>5</dim>
</port>
</output>
</layer>
@avitial @andrei-kochin Thanks for your deep investigation and the workaround to bypass this bug.
BTW, it seems that Legacy MO has been deprecated recently.
@jikechao indeed. My last message was more as a reference for developers not as a solution. However if it is urgent for you you can try the legacy ONNX to generate the IR. Legacy behavior can be used as a reference code to align behavior in ONNX FE.
@andrei-kochin Got it. Thank you!
OpenVINO Version
openvino-nightly 2023.2.0.dev20231101
Operating System
Ubuntu 18.04 (LTS)
Device used for inference
CPU
Framework
ONNX
Model used
https://github.com/jikechao/onnx_models/blob/main/dropout.onnx
Issue description
For the given model containing
Dropout
operator, OpenVINO can convert it into OV IR correctly and compile it well. However, when executing inference, it will report an error: Port for tensor name x was not found. I consider such behavior a bug because OpenVINO doesn't align with the ONNXRuntime rather than crash.Step-by-step reproduction
Relevant log output
Issue submission checklist