A simple tool to measure the performance of ONNX models in Python.
Project description
onnx-perf-test - ONNX Performance Test
A simple tool to measure the performance of ONNX models in Python.
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.1.0.tar.gz
(5.0 kB
view details)
Built Distribution
File details
Details for the file onnx_perf_test-0.1.0.tar.gz
.
File metadata
- Download URL: onnx_perf_test-0.1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9cceef9131173ff45c2bf586b5d20a7defc63ee52c52822a548408358d7b7c8 |
|
MD5 | bfff4193e5e7ff89876072c459ce4a8c |
|
BLAKE2b-256 | 349664b6ce0e87c99106b93540a34f15f18f8d1d3a4177f928a93426447a38bc |
File details
Details for the file onnx_perf_test-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: onnx_perf_test-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.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 | 13daeacb70382ca93c76a570a4c350373f2dd656713acd5b7f4ab86956c9e4e5 |
|
MD5 | df93a6c82e23765a9330764e88bdb4ea |
|
BLAKE2b-256 | 3be467ef02012ac64bd8d784d62c01273cd951ac10218903f39bff8af256648c |