RONN Python Bindings
High-performance Python bindings for RONN (Rust ONNX Neural Network) runtime.
Installation
Or build from source:
Quick Start
# Load ONNX model
=
# Create inference session
=
# Prepare input
=
=
# Run inference
=
=
Features
Optimization Levels
- O0 (none): No optimizations
- O1 (basic): Basic optimizations
- O2 (default): Default optimizations (recommended)
- O3 (aggressive): Aggressive optimizations for maximum performance
Execution Providers
- cpu: CPU execution (default)
- gpu: GPU execution (CUDA)
- bitnet: 1.58-bit quantized execution
- wasm: WebAssembly execution
Brain-Inspired Features
# Hierarchical Reasoning Module (HRM)
# Automatically routes simple tasks to fast path, complex to slow path
=
# Outputs use adaptive processing based on input complexity
Performance
RONN Python bindings provide near-native performance:
- Zero-copy tensor sharing where possible
- Efficient numpy array conversion
- Thread-safe concurrent inference
- Batch processing support
Advanced Usage
Batch Processing
# Configure batching
=
# Batch processor automatically groups requests
=
# Submit requests - automatically batched
= await
Async Inference
= await
return
# Run concurrent inferences
= await
Session Statistics
=
Model Information
# Get model inputs/outputs
# Get metadata
=
Type Support
Supported data types:
- float32 (f32) - Default
- float16 (f16) - Half precision
- bfloat16 (bf16) - Brain float
- int8 (i8) - Quantized
- uint8 (u8) - Unsigned quantized
Examples
See examples/python/ for complete examples:
- basic_inference.py - Simple inference
- batch_processing.py - Batch processing
- async_inference.py - Async concurrent inference
- model_inspection.py - Model metadata inspection
Benchmarks
Compare RONN vs ONNX Runtime:
Expected results:
- 2-5x faster than ONNX Runtime for small models
- 10-50x faster for batch inference
- Lower memory usage with pooling
Building
Requirements:
- Python 3.8+
- Rust 1.90+
- maturin
# Development build
# Release build
# Install wheel
License
MIT License - see LICENSE file