A simple tool to measure the performance of ONNX models in Python.
Project description
onnx-perf-test - ONNX Performance Test
A simple Python tool to measure the performance of ONNX models.
Installation
pip install onnx-perf-test
Usage
python onnx_perf_test.py {onnx_model} [--provider {provider}] [--num_runs {num_runs}] [--output_dir {output_dir}] [--draw] [--keep_profiling_file]
Arguments:
onnx_model
: Path to the ONNX model file.--provider
: Provider to use for inferencing. Default is uses onnxruntime.get_available_providers() to get the available providers. Options:TENSORRT
,CUDA
,CPU
...--num_runs
: Number of runs to average the performance. Default is 10.--output_dir
: Output directory to save the results. Does not save the results if not provided.--draw
: Draw the performance graph. Requiresmatplotlib
to be installed. Default isFalse
.--keep_profiling_file
: Keep the profiling file generated by onnxruntime. Default isFalse
.
Example
python onnx_perf_test.py model.onnx --provider CUDA --num_runs 20 --output_dir results --draw
Analyze ONNX Profiling File
Additionally, you can analyze your own .json
profiling file generated by ONNXRuntime using the analyze_onnx_profiling.py
script.
python analyze_onnx_profiling.py {onnx_profile_file} [--output_dir {output_dir}] [--draw]
Arguments:
onnx_profile_file
: Path to the ONNX profiling file.--output_dir
: Output directory to save the results. Does not save the results if not provided.--draw
: Draw the performance graph. Requiresmatplotlib
to be installed. Default isFalse
.
Example
python analyze_onnx_profiling.py model_profile.json --output_dir results --draw
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
onnx_perf_test-0.2.0.tar.gz
(5.9 kB
view hashes)
Built Distribution
Close
Hashes for onnx_perf_test-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2cc4c045304270205ae6f03b7236e34ab948b1ae8214bfc1f46263a2b73d240 |
|
MD5 | 1323c1c7f6dccae3d90e527fa7b61445 |
|
BLAKE2b-256 | 4e8a85bfc58da0537c16a49e75eb05773f2411e0b61737c37d68ff44a08956b1 |