skillfed

optimum

Optimum Library is an extension of the Hugging Face Transformers library, providing a framework to integrate third-party libraries from Hardware Partners and interface with their specific functionality.

optimum v2.3.0 2.1M downloads/30d#3,336 on PyPI3,461
Permissive license Apache Active released

What it is and what it does

Optimum is a framework that bridges HuggingFace models and specialized hardware accelerators, enabling efficient inference and training. It wraps Transformers, Diffusers, TIMM, and Sentence-Transformers to provide a unified interface for exporting models to optimized formats (ONNX, OpenVINO, ExecuTorch) and running them on diverse hardware—from Intel Gaudi HPUs and AWS Trainium to NVIDIA GPUs and edge devices. The core library handles the export logic and provides wrapper classes; hardware-specific optimizations are installed as optional extras.

Developers use Optimum when they need to deploy models beyond standard PyTorch inference—whether for quantization, pruning, cross-platform compatibility, or leveraging specialized accelerators. It abstracts away low-level hardware details while keeping the HuggingFace API familiar, so you can export a Transformers model and run it on Intel hardware or AWS instances without rewriting your inference code.

Use it for:

  • Export Transformers models to ONNX format for cross-platform deployment and graph optimization
  • Run quantized models on edge devices using ExecuTorch or OpenVINO for reduced latency and memory
  • Accelerate training on AWS Trainium or Intel Gaudi HPUs with minimal code changes to the standard Trainer
  • Deploy optimized models on NVIDIA GPUs via ONNX Runtime with performance tuning
  • Integrate third-party hardware partner libraries (Intel, AWS, AMD) without managing separate APIs

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Optimum provides optimization tools to export and run Transformers, Diffusers, and other HuggingFace models efficiently on specialized hardware accelerators like ONNX Runtime, OpenVINO, AWS Trainium, and Intel Gaudi.

Yes. Optimum is actively maintained, has no known vulnerabilities, and solves a real problem for anyone deploying HuggingFace models on non-standard hardware or needing quantization and export. The permissive Apache license and low install friction make it a low-risk addition. Install the base package for export capabilities, then add hardware-specific extras only when needed.

Install

optimum on PyPI

pip

pip install optimum

uv

uv add optimum

poetry

poetry add optimum

Installing optimum

Before you install

Low install friction with a pure-wheel distribution. Active maintenance with a recent release (10 days old) and steady repository activity. Depends on core libraries like transformers, torch, and huggingface_hub, which are standard in the ML ecosystem.

License in practice

Licensed under Apache 2.0 (permissive), allowing free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.

Quickstart

pip install optimum

from optimum.onnxruntime import ORTModelForSequenceClassification
from transformers import AutoTokenizer

model = ORTModelForSequenceClassification.from_pretrained(
    "model_id", from_transformers=True
)
tokenizer = AutoTokenizer.from_pretrained("model_id")
outputs = model(**tokenizer("Hello world", return_tensors="pt"))

Requires Python 3.9 or later. Hardware-specific features (ONNX Runtime, OpenVINO, Trainium, etc.) require additional optional dependencies installed separately.

Verify before relying

  • Performance gains and latency improvements for specific hardware targets and model sizes
  • Compatibility matrix and tested model architectures beyond Transformers
  • Memory overhead during export and optimization phases

Package facts

License Apache (permissive)
Python support supports the current Python release (>=3.9.0)
Install friction low — pure-Python wheel
Runtime dependencies 5 — transformers, torch, packaging, numpy, huggingface_hub
Maintenance actively maintained — 10 days since the last release
Last repo commit
First released
Downloads 2,055,714/month — #3,336 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: optimum-2.3.0-py3-none-any.whl

Keywords: transformers, quantization, pruning, optimization, training, inference, onnx, onnx runtime, intel, habana, graphcore, neural compressor, ipu, hpu

Development Status :: 5 - Production/StableIntended 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.9Topic :: Scientific/Engineering :: Artificial Intelligence

Tags

model optimization and exportaccelerated inference deploymentquantization and pruning toolshardware-specific model accelerationtransformers model optimizationonnx runtime integrationedge device model deployment
model-optimizationhardware-accelerationmodel-export

More Artificial Intelligence packages

Further reading