Hugging FacePhilipp SchmidAnnouncement
Accelerated Inference with Optimum and Transformers Pipelines
Summary
Transformer-based models are moving into production for large-scale workloads, but default implementations remain slow and resource-intensive compared to traditional machine learning algorithms. Hugging Face Optimum addresses this issue by integrating performance optimization tools and accelerated runtimes like ONNX Runtime directly into standard Transformers pipelines. Developers replace standard model classes with Optimum equivalents to convert models to ONNX, run graph optimizations such as operator fusion, and apply quantization. In an evaluation on an AWS EC2 m5.xlarge CPU instance, optimizing and quantizing a RoBERTa question-answering model cut average latency from 117.61 ms to 64.94 ms while retaining 99.61 percent accuracy. Known limitations include a 2GB remote model size limit, lack of seq2seq support, omitted past key values in causal language models, and no local caching for optimized ONNX models.
Context
Transformer-based architectures deployed to production environments are relatively slow, large, and complex compared to traditional machine learning algorithms.
Approach / What changed
Hugging Face introduced inference and pipeline integration in Optimum 1.2, providing API-compatible ORTModel classes, ORTOptimizer for graph transformations, and ORTQuantizer to convert, optimize, and run models with ONNX Runtime.
Takeaways
Optimum 1.2 introduces drop-in replacements for Hugging Face AutoModel classes, mapping them to ORTModel classes for execution with ONNX Runtime and Transformers pipelines.
Graph optimization and dynamic quantization reduced RoBERTa question-answering latency from 117.61 ms to 64.94 ms on an m5.xlarge CPU instance while preserving 99.61 percent accuracy.
Current limitations include a 2GB limit on remote Hub models, no seq2seq support, lack of past key values in causal generation models, and no local caching for ONNX models.
Source and freshness
- Source
- huggingface.co
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.