Skip to content

Releases: huggingface/optimum

v1.20.0: VITS, Phi-3 ONNX export

29 May 15:10
Compare
Choose a tag to compare

Extended ONNX export

Other changes and bugfixes

New Contributors

Full Changelog: v1.19.0...v1.20.0

v1.19.2: Patch release

09 May 11:17
Compare
Choose a tag to compare
  • Update the Transformers dependency in the Habana extra #1851 @regisss

Full Changelog: v1.19.1...v1.19.2

v1.19.1: Patch release

24 Apr 12:35
Compare
Choose a tag to compare
  • Bump transformers version by @echarlaix in #1824
  • Remove call to apt update before apt purge in the main doc build workflow by @regisss in #1830

Full Changelog: v1.19.0...v1.19.1

v1.19.0: Musicgen, MarkupLM ONNX export

16 Apr 13:45
Compare
Choose a tag to compare

Extended ONNX export

Musicgen and MarkupLM models from Transformers can now be exported to ONNX through optimum-cli export onnx. Musicgen ONNX export is used to run the model locally in a browser through transformers.js.

Other changes and bugfixes

New Contributors

Full Changelog: v1.18.0...v1.19.0

v1.18.1: Patch release

09 Apr 09:58
Compare
Choose a tag to compare

Fix the installation for Optimum Neuron v0.0.21 release

  • Improve the installation of optimum-neuron through optimum extras #1778

Fix the task inference of stable diffusion

  • Fix infer task for stable diffusion #1793

Full Changelog: v1.18.0...v1.18.1

v1.18.0: Gemma, OWLv2, MPNet Qwen2 ONNX support

25 Mar 13:32
Compare
Choose a tag to compare

New architectures ONNX export :

Other changes and bugfixes

v1.17.1: Patch release

18 Feb 02:19
Compare
Choose a tag to compare

Update Transformers dependency for the release of Optimum Habana v1.10.2

  • Update Transformers dependency in Habana extra #1700

Full Changelog: v1.17.0...v1.17.1

v1.17.0: Improved ONNX support & many bugfixes

16 Feb 09:22
Compare
Choose a tag to compare

ONNX export from nn.Module

A function is exposed to programmatically export any nn.Module (e.g. models coming from Transformers, but modified). This is useful in case you need to do some modifications on models loaded from the Hub before exporting. Example:

from transformers import AutoModelForImageClassification
from optimum.exporters.onnx import onnx_export_from_model

model = AutoModelForImageClassification.from_pretrained("google/vit-base-patch16-224")

# Here one could do any modification on the model before the export.
onnx_export_from_model(model, output="vit_onnx")

ONNX export with static shapes

The Optimum ONNX export CLI allows to disable dynamic shape for inputs/outputs:

 optimum-cli export onnx --model timm/ese_vovnet39b.ra_in1k  out_vov --no-dynamic-axes

This is useful if the exported model is to be consumed by a runtime that does not support dynamic shapes. The static shape can be specified e.g. with --batch_size 1 . See all the shape options in optimum-cli export onnx --help.

BF16 ONNX export

The Optimum ONNX export now supports BF16 export on CPU and GPU. Beware though that ONNX Runtime is most often not able to consume the models as some operation are not implemented in this data type, although the exported models comply with ONNX standard. This is useful if you are developing a runtime that consomes BF16 ONNX models.

Example:

optimum-cli export onnx --model bert-base-uncased --dtype bf16 bert_onnx 

ONNX export for news models

You can now export to ONNX table-transformer, bart for text-classification.

Sentence Transformers ONNX export

Timm models support with ONNX Runtime

Timm models can now be run through ONNX Runtime with the class ORTModelForImageClassification:

from urllib.request import urlopen

import timm
import torch
from PIL import Image

from optimum.onnxruntime import ORTModelForImageClassification

# Export the model to ONNX under the hood with export=True.
model = ORTModelForImageClassification.from_pretrained("timm/resnext101_64x4d.c1_in1k", export=True)

# Get model specific transforms (normalization, resize).
data_config = timm.data.resolve_data_config(pretrained_cfg=model.config.pretrained_cfg)
transforms = timm.data.create_transform(**data_config, is_training=False)

img = Image.open(
    urlopen("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png")
)
output = model(transforms(img).unsqueeze(0)).logits
top5_probabilities, top5_class_indices = torch.topk(torch.softmax(output, dim=1) * 100, k=5)

Other changes and bugfixes

New Contributors

Full Changelog: v1.16.0...v1.17.0

v1.16.2: Patch release

19 Jan 16:01
Compare
Choose a tag to compare
  • Fix ORT training compatibility for transformers v4.36.0 by @AdamLouly #1586

  • Fix ONNX export compatibility for transformers v4.37.0 by @echarlaix #1641

v1.16.1: Patch release

15 Dec 10:54
Compare
Choose a tag to compare

Breaking change: BetterTransformer llama, falcon, whisper, bart is deprecated

The features from BetterTransformer for Llama, Falcon, Whisper and Bart have been upstreamed in Transformers. Please use transformers>=4.36 and torch>=2.1.1 to use by default PyTorch's scaled_dot_product_attention.

More details: https://github.com/huggingface/transformers/releases/tag/v4.36.0

What's Changed

New Contributors

Full Changelog: v1.16.0...v1.16.1