Static pre-flight checker for ONNX -> TensorRT conversion.
Project description
trtcheck
Static pre-flight checker for ONNX to TensorRT conversion.
trtcheck reads an ONNX file, runs five independent checkers against it, and
tells you in seconds whether the model will convert cleanly to a TensorRT
engine. If it won't, the report explains what to fix. It runs anywhere
Python runs: no TensorRT, no CUDA driver, no GPU required.
Why
The PyTorch -> ONNX -> TensorRT pipeline fails most of the time on the last hop. The errors are cryptic and the iteration loop ("export, wait two minutes, read a C++ traceback, google, try again") burns hours per fix.
trtcheck predicts the failure modes locally so you can correct them
before invoking trtexec.
Install
pip install trtcheck
Or from source:
git clone https://github.com/sohams25/trtcheck.git
cd trtcheck
pip install -e ".[dev]"
Requires Python 3.10+.
Usage
# Basic check (defaults to TensorRT 10.3)
trtcheck model.onnx
# Target a specific TensorRT version
trtcheck model.onnx --target-trt 8.6
# Machine-readable output for CI
trtcheck model.onnx --format json --output report.json
# Self-contained HTML report
trtcheck model.onnx --format html --output report.html
# Filter to blockers only
trtcheck model.onnx --severity critical
# Compare two versions of a model (before/after a fix)
trtcheck before.onnx after.onnx --diff
Exit code is 1 if conversion is unlikely to succeed, 0 otherwise. Wire
that into CI to catch regressions at PR time.
What it checks
| Checker | Catches |
|---|---|
| operator support | Ops missing or partial in the target TRT version (e.g. SequenceEmpty, GroupNormalization on TRT 8.x) |
| precision | UINT8/FLOAT64/STRING inputs, INT64 weights, BF16 on older targets |
| dynamic shapes | Multiple symbolic dims on inputs |
| control flow | Loop with runtime trip count, nested Loop, If, Scan |
| graph structure | Empty outputs, duplicate node names, oversized constants |
Each finding includes a specific remediation, not just "this is bad."
How the operator matrix is maintained
The TRT-version-to-operator support table lives in
trtcheck/data/operator_matrix.json and is hand curated. To refresh it for
a new TensorRT release:
- Edit
tools/build_operator_matrix.py(the source of truth). - Run
python tools/build_operator_matrix.pyto regenerate the JSON. - Run the test suite:
pytest tests/test_data_files.py -v. - Commit both the script change and the regenerated JSON.
Development
# Set up
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
# Tests
./scripts/run-tests.sh
# Type check
mypy trtcheck/
# Format
black . && isort .
If you contribute a new checker, follow the TDD cycle: write the test
first, confirm it fails, then implement. See CLAUDE.md for the full
project conventions.
Roadmap
--fixauto-rewrite for the simpler cases (UINT8 -> FP32 cast insertion, INT64 -> INT32 weight rewriting).- HTML diff view with side-by-side columns.
- Quarterly refresh tooling driven by NVIDIA release notes.
See CHANGELOG.md for release notes.
License
MIT. See LICENSE.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trtcheck-0.1.1.tar.gz.
File metadata
- Download URL: trtcheck-0.1.1.tar.gz
- Upload date:
- Size: 36.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcfbff0a4c24d22a01a76d091b731dc4b6cad975a06206aad6fe7f5b20c25746
|
|
| MD5 |
9d78778121c796a74505585b1955d7e0
|
|
| BLAKE2b-256 |
61fa80718d1febe415ad5f439aeb5072f790bf09474fe79f7907846263f2c96c
|
Provenance
The following attestation bundles were made for trtcheck-0.1.1.tar.gz:
Publisher:
release.yml on sohams25/trtcheck
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trtcheck-0.1.1.tar.gz -
Subject digest:
bcfbff0a4c24d22a01a76d091b731dc4b6cad975a06206aad6fe7f5b20c25746 - Sigstore transparency entry: 1591146288
- Sigstore integration time:
-
Permalink:
sohams25/trtcheck@2db940e2cb2192ea8d38d39bca4fdd2770b13bb3 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/sohams25
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2db940e2cb2192ea8d38d39bca4fdd2770b13bb3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file trtcheck-0.1.1-py3-none-any.whl.
File metadata
- Download URL: trtcheck-0.1.1-py3-none-any.whl
- Upload date:
- Size: 29.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96fd026dc3b31b6408ffa99711868069b708c194158ddaf4a9829b397ca87f9e
|
|
| MD5 |
596af47b87e12fa5cf5cf930d052e819
|
|
| BLAKE2b-256 |
a8015f6fa6861845db0a111d2d770eb5963e2ad539980acfcef4778091aff48d
|
Provenance
The following attestation bundles were made for trtcheck-0.1.1-py3-none-any.whl:
Publisher:
release.yml on sohams25/trtcheck
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trtcheck-0.1.1-py3-none-any.whl -
Subject digest:
96fd026dc3b31b6408ffa99711868069b708c194158ddaf4a9829b397ca87f9e - Sigstore transparency entry: 1591146346
- Sigstore integration time:
-
Permalink:
sohams25/trtcheck@2db940e2cb2192ea8d38d39bca4fdd2770b13bb3 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/sohams25
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2db940e2cb2192ea8d38d39bca4fdd2770b13bb3 -
Trigger Event:
push
-
Statement type: