Optimum

Latest version: v1.23.3

Safety actively analyzes 678576 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 16 of 22

1.5.2

* Fix `OVModel` model configuration loading for `optimum` `v1.5.0` (110)
* Add possibility to save the ONNX model resulting from the OpenVINO export (99)
* Add `OVModel` options for model compilation (108)
* Add default model loading for `IncQuantizedModel` (113)

1.5.1

* Add Neural Compressor torch 1.13 quantization support (95)
* Remove the `IncTrainer`'s deprecated `_load_state_dict_in_model` method (84)
* Add `ModelForVision2Seq` INC support (70)
* Rename `OVModel` device attribute for `transformers` v2.24.0 compatibility (94)
* Rename openvino model file name (93)

1.5.0

Quantization

* Add `OVQuantizer` enabling OpenVINO NNCF post-training static quantization (50)
* Add `OVTrainer` enabling OpenVINO NNCF quantization aware training (67)
* Add `OVConfig` the configuration which contains the quantization process informations (65)

The quantized model resulting from the `OVQuantizer` and the `OVTrainer` are exported to the OpenVINO IR and can be loaded with the corresponding `OVModelForXxx` to perform inference with OpenVINO Runtime.

OVModel

Add `OVModelForCausalLM` enabling OpenVINO Runtime for models with a causal language modeling head (76)

1.4.1

* Add inference with `ORTModel` to `ORTTrainer` and `ORTSeq2SeqTrainer` 189
* Add `InferenceSession` options and provider to `ORTModel` 271
* Add mT5 (341) and Marian (393) support to `ORTOptimizer`
* Add batchnorm folding `torch.fx` transformations 348
* The `torch.fx` transformations now use the marking methods `mark_as_transformed`, `mark_as_restored`, `get_transformed_nodes` 385
* Update `BaseConfig` for `transformers` `4.22.0` release 386
* Update `ORTTrainer` for `transformers` `4.22.1` release 388
* Add extra ONNX Runtime quantization options 398
* Add possibility to pass `provider_options` to `ORTModel` 401
* Add support to pass a specific device for `ORTModel`, as `transformers` does for pipelines 427
* Fixes to support onnxruntime 1.13.1 430

1.4.0

[OVModel](https://github.com/huggingface/optimum-intel/blob/main/optimum/intel/openvino/modeling_base.py#L57) classes were integrated with the [🤗 Hub](https://hf.co/models) in order to easily export models through the OpenVINO IR, save and load those resulting models, as well as to easily perform inference.

* Add OVModel classes enabling OpenVINO inference 21

Below is an example that downloads a DistilBERT model from the Hub, exports it through the OpenVINO IR and saves it:

python
from optimum.intel.openvino import OVModelForSequenceClassification

model_id = "distilbert-base-uncased-finetuned-sst-2-english"
model = OVModelForSequenceClassification.from_pretrained(model_id, from_transformers=True)
model.save_pretrained(save_directory)

The currently supported model topologies are the following :

* `OVModelForSequenceClassification`
* `OVModelForTokenClassification`
* `OVModelForQuestionAnswering`
* `OVModelForFeatureExtraction`
* `OVModelForMaskedLM`
* `OVModelForImageClassification`
* `OVModelForSeq2SeqLM`

Pipelines
The Transformers [pipelines](https://huggingface.co/docs/transformers/main/en/main_classes/pipelines#pipelines) support was added, providing an easy way to use OVModels for inference.

diff
-from transformers import AutoModelForSeq2SeqLM
+from optimum.intel.openvino import OVModelForSeq2SeqLM
from transformers import AutoTokenizer, pipeline

model_id = "Helsinki-NLP/opus-mt-en-fr"
-model = AutoModelForSeq2SeqLM.from_pretrained(model_id)
+model = OVModelForSeq2SeqLM.from_pretrained(model_id, from_transformers=True)
tokenizer = AutoTokenizer.from_pretrained(model_id)
pipe = pipeline("translation_en_to_fr", model=model, tokenizer=tokenizer)
text = "He never went out without a book under his arm, and he often came back with two."
outputs = pipe(text)


By default, OVModels support dynamic shapes enabling inputs of every shapes (without any constraint on the batch size or sequence length). To decrease latency, static shapes can be enabled by giving the desired inputs shapes.

* Add OVModel static shapes 41

python
model.reshape(1, 20)

FP16 precision can also be enabled.

* Add OVModel fp16 support 45

python
model.half()

1.3.1

* Adapt INC configuration and quantized model loading for transformers release 4.22 27
* Fix loss computation when distillation is activated while the weights corresponding to the distillation loss is set to 0 26

Page 16 of 22

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.