torch-ort accelerates PyTorch models using ONNX Runtime. Version 1.19.2 supports PyTorch 2.x and ONNX Runtime 1.19.x. Released monthly in sync with ONNX Runtime.
pip install torch-ortVerified import paths — ran on the pinned version, not inferred.
Wrap a PyTorch model with ORTModule to accelerate inference/training via ONNX Runtime.
Upgrade onnxruntime to 1.14+ or pin torch-ort to <1.14.0.
Remove calls to enable_training; ORTModule now auto-detects training vs inference.
Test model with ORTModule and fallback to native PyTorch if unsupported ops are encountered. Use ort_model.debug() to trace unsupported operators.
Convert model _before_ training or after final eval to avoid key mismatch. Use model.load_state_dict on the original model, not the ORTModule-wrapped one.