TLDRocket
Sign in

Model Conversion

1 summarised story about Model Conversion, each linking back to the original source. Browse all topics →

Wednesday, 22 June 2022

Convert Transformers to ONNX with Hugging Face Optimum

Hugging Face Blog 4 years ago

Hugging Face Optimum provides three methods to convert Transformer models to ONNX format, ranging from low-level PyTorch APIs to high-level abstraction classes. The simplest approach uses ORTModelForSequenceClassification with a single from_pretrained() call and the from_transformers=True parameter. Developers can choose between torch.onnx for fine-grained control, transformers.onnx for simplified configuration, or Optimum for immediate inference capability without additional conversion steps.