Convert Transformers to ONNX with Hugging Face Optimum
Jun 22, 2022
Summary
This post details how to convert Hugging Face Transformers models to the ONNX format using the Hugging Face Optimum library. It explains the benefits of ONNX for deployment and provides three methods for conversion: low-level `torch.onnx.export`, mid-level `transformers.onnx.export`, and high-level `optimum.onnxruntime.ORTModelForXxx.from_pretrained`. It also lists supported architectures and suggests next steps like accelerated inference, quantization, and training with ONNX.
More from the IPU-Ready Transformers Optimization trail
- Accelerating PyTorch Transformers with Intel Sapphire Rapids - part 2
- Optimum+ONNX Runtime - Easier, Faster training for your Hugging Face models
- Accelerating PyTorch Transformers with Intel Sapphire Rapids - part 1
- Accelerate your models with 🤗 Optimum Intel and OpenVINO
- Pre-Train BERT with Hugging Face Transformers and Habana Gaudi