Skip to main content

Utilities for making TensorRT easier to use

Project description

trtutils

PyPI CodeFactor

MyPy Ruff PyPi Build

A high-level Python interface for TensorRT inference, providing a simple and unified way to run arbitrary TensorRT engines. This library abstracts away the complexity of CUDA memory management, binding management, and engine execution, making it easy to perform inference with any TensorRT engine.

Features

  • Simple, high-level interface for TensorRT inference
  • Automatic CUDA memory management
  • Support for arbitrary TensorRT engines
  • Built-in preprocessing and postprocessing capabilities
  • Comprehensive type hints and documentation
  • Support for both basic engine execution and end-to-end model inference

Quick Start

Basic Engine Usage

The TRTEngine class provides a simple interface for running any TensorRT engine:

from trtutils import TRTEngine

# Load your TensorRT engine
engine = TRTEngine("path_to_engine")

# Get input specifications
print(engine.input_shapes)  # Expected input shapes
print(engine.input_dtypes)  # Expected input data types

# Run inference
inputs = read_your_data()
outputs = engine.execute(inputs)

Installation

pip install trtutils

For additional features, you can install optional dependencies:

# For JIT compiler
pip install "trtutils[jit]"

# For development
pip install "trtutils[dev]"

Documentation

For detailed documentation, including advanced usage, examples, and API reference, visit our documentation site.

Examples

Check out our examples directory for more detailed usage examples, including:

  • Basic engine usage
  • End-to-end model inference
  • YOLO model implementation
  • Benchmarking utilities

Performance

Device YOLOv8m YOLOv8n
OrinAGX-64GB OrinAGX-64GB YOLOv8m OrinAGX-64GB YOLOv8n
OrinAGX-32GB OrinAGX-32GB YOLOv8m OrinAGX-32GB YOLOv8n
OrinNX-16GB OrinNX-16GB YOLOv8m OrinNX-16GB YOLOv8n
OrinNano-8GB OrinNano-8GB YOLOv8m OrinNano-8GB YOLOv8n
XavierNX-8GB XavierNX-8GB YOLOv8m XavierNX-8GB YOLOv8n
3080Ti 3080Ti YOLOv8m 3080Ti YOLOv8n
TitanRTX TitanRTX YOLOv8m TitanRTX YOLOv8n

License

This project is licensed under the MIT License - see the LICENSE file for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trtutils-0.6.1.tar.gz (80.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trtutils-0.6.1-py3-none-any.whl (106.1 kB view details)

Uploaded Python 3

File details

Details for the file trtutils-0.6.1.tar.gz.

File metadata

  • Download URL: trtutils-0.6.1.tar.gz
  • Upload date:
  • Size: 80.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for trtutils-0.6.1.tar.gz
Algorithm Hash digest
SHA256 31092c436f354874289f9f90b627e9c7e07aa787bf5f72630b8eb732f96caa66
MD5 cde8f2ec544176fbe157f90145246705
BLAKE2b-256 1fb51fb8fa63f204ccd872c8b69b3593932c30a537e44034fe31d86147a8998a

See more details on using hashes here.

File details

Details for the file trtutils-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: trtutils-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 106.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for trtutils-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e41f5c7a5c59d3140d5f0ec56b6682e3fea6dbcdbac84d69ef27b32cb0f9cd1a
MD5 b772d36df53d1ec5f36672e6898f1d48
BLAKE2b-256 2436f6d5d4ff6a44957f8698d15141f8c9a7421851387e4771da7f8d4359b9f5

See more details on using hashes here.

Supported by

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