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 details)
Built Distribution
File details
Details for the file onnx_perf_test-0.2.0.tar.gz
.
File metadata
- Download URL: onnx_perf_test-0.2.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f58dd9eb132137f875f65c88f8ab7f04cf64270719b3492cf85a5e6c73cf91dc |
|
MD5 | dc4df06f597df5e705eec662b14c0580 |
|
BLAKE2b-256 | ec74c86902c693ea91a13fbdbf2ff4ec993ddc210b4f06275c8a6de269d6fa00 |
File details
Details for the file onnx_perf_test-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: onnx_perf_test-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2cc4c045304270205ae6f03b7236e34ab948b1ae8214bfc1f46263a2b73d240 |
|
MD5 | 1323c1c7f6dccae3d90e527fa7b61445 |
|
BLAKE2b-256 | 4e8a85bfc58da0537c16a49e75eb05773f2411e0b61737c37d68ff44a08956b1 |