Given a model and targeted hardware, Olive (abbreviation of Onnx LIVE) composes the best suitable optimization techniques to output the most efficient ONNX model(s) for inferencing on the cloud or edge, while taking a set of constraints such as accuracy and latency into consideration.
Here are some recent videos, blog articles and labs that highlight Olive:
For a full list of news and blogs, read the news archive.
If you prefer using the command line directly instead of Jupyter notebooks, we've outlined the quickstart commands here.
We recommend installing Olive in a virtual environment or a conda environment.
pip install olive-ai
pip install transformers onnxruntime-genai
[!NOTE] Olive has optional dependencies that can be installed to enable additional features. Please refer to Olive package config for the list of extras and their dependencies.
[!NOTE] For Windows users: to avoid HF_HUB_DISABLE_SYMLINKS_WARNING
Olive depends on huggingface_hub library if you download models from there. On Windows you will get a warning like
UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\Users\name\.cache\huggingface\hub\model-name. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.You can fix this warning using one of the 4 options below. Note that options 1, 2, and 3 save disk space, while option 4 only suppresses the warning.
- Enable Developer Mode on Windows (one-time setup) documented in the Microsoft Developer Tools Docs.
- Run Python as administrator when using Olive with the huggingface_hub library.
- Reconfigure where the cache is stored. This restriction is not limited to storing the cache in the default location only.
- Keep using HF_HUB_DISABLE_SYMLINKS_WARNING=1 to suppress the warning and accept the extra disk usage.
Regarding the options, you should decide what is possible in your environment (e.g. company policy) and what fits best for you.
The limitation of the huggingface_hub library is also documentd in the Hub Client Library Docs.
In this quickstart you'll be optimizing Qwen/Qwen2.5-0.5B-Instruct, which has many model files in the Hugging Face repo for different precisions that are not required by Olive.
Run the automatic optimization:
olive optimize \
--model_name_or_path Qwen/Qwen2.5-0.5B-Instruct \
--precision int4 \
--output_path models/qwen
[!TIP]
PowerShell Users
Line continuations between Bash and PowerShell are not interchangeable. If you are using PowerShell, then you can copy-and-paste the following command that uses compatible line continuation.olive optimize ` --model_name_or_path Qwen/Qwen2.5-0.5B-Instruct ` --output_path models/qwen ` --precision int4
The automatic optimizer will:
int4 using GPTQ.Olive can automatically optimize popular model architectures like Llama, Phi, Qwen, Gemma, etc out-of-the-box - see detailed list here. Also, you can optimize other model architectures by providing details on the input/outputs of the model (io_config).
The ONNX Runtime (ORT) is a fast and light-weight cross-platform inference engine with bindings for popular programming language such as Python, C/C++, C#, Java, JavaScript, etc. ORT enables you to infuse AI models into your applications so that inference is handled on-device.
The sample chat app to run is found as model-chat.py in the onnxruntime-genai Github repository.
Distributions of this project may collect usage data and send it to Microsoft to help improve our products and services. See the privacy statement for more details.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
(top 30 of 79)
Python
98.2%
Jupyter Notebook
1.6%
Given a model and targeted hardware, Olive (abbreviation of Onnx LIVE) composes the best suitable optimization techniques to output the most efficient ONNX model(s) for inferencing on the cloud or edge, while taking a set of constraints such as accuracy and latency into consideration.
Here are some recent videos, blog articles and labs that highlight Olive:
For a full list of news and blogs, read the news archive.
If you prefer using the command line directly instead of Jupyter notebooks, we've outlined the quickstart commands here.
We recommend installing Olive in a virtual environment or a conda environment.
pip install olive-ai
pip install transformers onnxruntime-genai
[!NOTE] Olive has optional dependencies that can be installed to enable additional features. Please refer to Olive package config for the list of extras and their dependencies.
[!NOTE] For Windows users: to avoid HF_HUB_DISABLE_SYMLINKS_WARNING
Olive depends on huggingface_hub library if you download models from there. On Windows you will get a warning like
UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\Users\name\.cache\huggingface\hub\model-name. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.You can fix this warning using one of the 4 options below. Note that options 1, 2, and 3 save disk space, while option 4 only suppresses the warning.
- Enable Developer Mode on Windows (one-time setup) documented in the Microsoft Developer Tools Docs.
- Run Python as administrator when using Olive with the huggingface_hub library.
- Reconfigure where the cache is stored. This restriction is not limited to storing the cache in the default location only.
- Keep using HF_HUB_DISABLE_SYMLINKS_WARNING=1 to suppress the warning and accept the extra disk usage.
Regarding the options, you should decide what is possible in your environment (e.g. company policy) and what fits best for you.
The limitation of the huggingface_hub library is also documentd in the Hub Client Library Docs.
In this quickstart you'll be optimizing Qwen/Qwen2.5-0.5B-Instruct, which has many model files in the Hugging Face repo for different precisions that are not required by Olive.
Run the automatic optimization:
olive optimize \
--model_name_or_path Qwen/Qwen2.5-0.5B-Instruct \
--precision int4 \
--output_path models/qwen
[!TIP]
PowerShell Users
Line continuations between Bash and PowerShell are not interchangeable. If you are using PowerShell, then you can copy-and-paste the following command that uses compatible line continuation.olive optimize ` --model_name_or_path Qwen/Qwen2.5-0.5B-Instruct ` --output_path models/qwen ` --precision int4
The automatic optimizer will:
int4 using GPTQ.Olive can automatically optimize popular model architectures like Llama, Phi, Qwen, Gemma, etc out-of-the-box - see detailed list here. Also, you can optimize other model architectures by providing details on the input/outputs of the model (io_config).
The ONNX Runtime (ORT) is a fast and light-weight cross-platform inference engine with bindings for popular programming language such as Python, C/C++, C#, Java, JavaScript, etc. ORT enables you to infuse AI models into your applications so that inference is handled on-device.
The sample chat app to run is found as model-chat.py in the onnxruntime-genai Github repository.
Distributions of this project may collect usage data and send it to Microsoft to help improve our products and services. See the privacy statement for more details.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
(top 30 of 79)
Python
98.2%
Jupyter Notebook
1.6%