Skip to main content

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. Requires matplotlib to be installed. Default is False.
  • --keep_profiling_file: Keep the profiling file generated by onnxruntime. Default is False.

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. Requires matplotlib to be installed. Default is False.

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)

Uploaded Source

Built Distribution

onnx_perf_test-0.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

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

Hashes for onnx_perf_test-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e9cceef9131173ff45c2bf586b5d20a7defc63ee52c52822a548408358d7b7c8
MD5 bfff4193e5e7ff89876072c459ce4a8c
BLAKE2b-256 349664b6ce0e87c99106b93540a34f15f18f8d1d3a4177f928a93426447a38bc

See more details on using hashes here.

File details

Details for the file onnx_perf_test-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for onnx_perf_test-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 13daeacb70382ca93c76a570a4c350373f2dd656713acd5b7f4ab86956c9e4e5
MD5 df93a6c82e23765a9330764e88bdb4ea
BLAKE2b-256 3be467ef02012ac64bd8d784d62c01273cd951ac10218903f39bff8af256648c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page