optimum-onnx
Optimum ONNX is an interface between the Hugging Face libraries and ONNX / ONNX Runtime
Decision gist · record as of 2026-08-14
Yes, if you need to export Hugging Face models to ONNX for deployment or performance optimization. The low install friction, active maintenance, permissive license, and zero known vulnerabilities make it safe to try. Pre-Alpha status means the API may shift, but the project is backed by Hugging Face and already handles real models.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- GPU inference requires CUDA and cuDNN; avoid installing both onnxruntime and onnxruntime-gpu simultaneously.
- Low friction install with a pure Python wheel.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 permissive license allows commercial and private use with minimal restrictions.
last release 2025-12-23 (234 days) · last repo commit 2026-07-21 · 160 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 679,411 downloads/mo, #5,369 on PyPI
Alternatives
Verify before relying
pip install "optimum-onnx[onnxruntime]"
from optimum.onnxruntime import ORTModelForCausalLM
from transformers import AutoTokenizer
model = ORTModelForCausalLM.from_pretrained("onnx-community/Llama-3.2-1B", subfolder="onnx")
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B")- Performance gains (latency, throughput, memory) compared to PyTorch inference on typical models
- Supported model architectures beyond the examples shown
- Quantization options available and their impact on model accuracy
- Compatibility with Diffusers, Timm, and Sentence Transformers models as mentioned
What it is and what it does
optimum-onnx bridges Hugging Face transformer models and the ONNX ecosystem, enabling you to export PyTorch checkpoints to ONNX format and run them via ONNX Runtime. It provides command-line tooling for export with optional graph optimization and quantization, plus Python classes that wrap ONNX Runtime to maintain a familiar Hugging Face API surface for inference.
The package targets developers who want faster or more portable inference than standard PyTorch, particularly for deployment scenarios where ONNX Runtime's performance characteristics or cross-platform support matter. It depends on transformers, optimum, and onnx, and supports Python 3.9 through 3.13. The project is actively maintained but marked Pre-Alpha, reflecting its early maturity.
Use it for
- Export a transformer to ONNX and quantize it for faster CPU or GPU inference
- Deploy a model to environments where ONNX Runtime is preferred over PyTorch for size or performance
- Run inference on exported ONNX models using the ORTModelForXXX classes with minimal code changes
- Optimize and benchmark models in ONNX format for production serving
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to export Hugging Face models to ONNX for deployment or performance optimization.
The low install friction, active maintenance, permissive license, and zero known vulnerabilities make it safe to try. Pre-Alpha status means the API may shift, but the project is backed by Hugging Face and already handles real models.
Install
optimum-onnx on PyPI
Before you install
Low friction install with a pure Python wheel. Active maintenance with recent commits and no known vulnerabilities. Early stage (Pre-Alpha) but backed by Hugging Face infrastructure.
Requires Python 3.9 or later. GPU inference requires CUDA and cuDNN; avoid installing both onnxruntime and onnxruntime-gpu simultaneously.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions.
Quickstart
pip install "optimum-onnx[onnxruntime]"
from optimum.onnxruntime import ORTModelForCausalLM
from transformers import AutoTokenizer
model = ORTModelForCausalLM.from_pretrained("onnx-community/Llama-3.2-1B", subfolder="onnx")
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B")
Verify before relying
- Performance gains (latency, throughput, memory) compared to PyTorch inference on typical models
- Supported model architectures beyond the examples shown
- Quantization options available and their impact on model accuracy
- Compatibility with Diffusers, Timm, and Sentence Transformers models as mentioned
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.9.0 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesoptimumtransformersonnx |
| Maintenance | Actively maintained 234 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 679,411 / month, #5,369 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 2 - Pre-AlphaIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Scientific/Engineering :: Artificial Intelligence |
Evidence: optimum_onnx-0.1.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “export hugging face models to onnx”
- optimum-onnxExports Hugging Face transformer models to ONNX format and runs them…
- nvidia-modeloptApplies state-of-the-art model optimization techniques—quantization,…
- onnxruntime_extensionsExtends ONNX Runtime with custom operators for pre- and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also optimum · optimum-intel · onnxslim · nvidia-modelopt · onnxruntime-genai · skl2onnx · onnx-tool · onnxruntime_extensions · optimum-quanto · onnxruntime