Optimum is a Hugging Face Transformers extension for optimizing model training and inference on target hardware. Its ONNX Runtime integration supports model export, graph optimization, and quantization while keeping common workflows at a high level. section 6.3
An ONNX Runtime workflow typically includes:
- Load a task-specific `ORTModelForXxx` class and export a Transformers model to ONNX. section 6.3
Optimizing a sequence classifier
Load a pretrained sequence-classification model with `ORTModelForSequenceClassification.from_pretrained(..., export=True)`, save the ONNX artifact, quantize it with an AVX512-VNNI configuration, and run the result through a Transformers pipeline. Compare its accuracy on Banking77 with the unoptimized pipeline and measure repeated inference latency.
