Profile onnx models anywhere, anytime
This tool allows you to profile ONNX models using ONNX Runtime. It generates dummy inputs based on the model's input shapes and performs profiling on both CPU and CUDA devices (if available). The profiling results are saved as JSON files.
- Automatically derives input shapes and data types from the ONNX model.
- Profiles the model on CPU, CUDA (if supported) and DirectML(if supported).
- Generates profiling outputs in JSON format, saved alongside the model.
- Provides a simple API for profiling and describing ONNX models.
pip install git+https://github.com/Param-Uttarwar/onnx-profiler.git
from onnxprofiler import profile
profile("model.onnx", num_runs=5)
Saved as <device>_profile_<model_name>_<time>.json at the same location as the model.
- Use Perfetto UI to visualize the profiling results.
from onnxprofiler import describe
describe("model.onnx")
Prints output to the console.
- Python 3.7+
- ONNX
- ONNX Runtime
- NumPy