TorchScript packages PyTorch programs as a serializable, optimizable intermediate representation that can execute independently of Python, including in standalone C++ applications. Triton requires PyTorch models in this format for serving. section 7.4.3
A practical TorchScript serving workflow is:
- Place the model in Triton’s model repository alongside config.pbtxt, register it through the management API, and send inference requests. section 7.4.3
Tracing a PyTorch model
After defining a model, call model.eval(), create an example tensor such as torch.rand(1, 3, 224, 224), trace with torch.jit.trace, and save traced_torch_model.pt.
