This folder contains actively maintained examples of use of Olive with different models, optimization tools and hardware.
Each example is a self-contained folder with a README.md
file that explains how to run it.
To ensure that the latest versions of the examples can be run without issues, you have to install Olive from source. We also recommend using a new conda or virtual environment.
To install Olive from source, run the following command in a new conda or virtual environment:
git clone https://github.com/microsoft/Olive.git
cd Olive
python -m pip install .
Then cd into the desired example folder and follow the instructions in the README.md
file.
For examples corresponding to a specific release of Olive, checkout the corresponding tag. For instance, to use the examples corresponding to the v0.2.0
release, run the following command:
git checkout tags/v0.2.0
Note: Olive installs torch
as a dependency from the PyPI feed. On Windows, this feed installs the CPU version of torch
by default. If you want to install a version of torch
with CUDA support, please install it manually following the instructions in the PyTorch documentation.
To create a new conda environment and activate it, run the following command:
conda create -n olive-env python=3.12
conda activate olive-env
You can replace olive-env
with any name you want and python=3.12
with the version of python you want to use.
Please refer to the conda documentation for more information on how to create and manage conda environments.
To create a new virtual environment and activate it, run the following command:
On Linux:
python -m venv olive-env
source olive-env/bin/activate
On Windows (CMD):
python -m venv olive-env
olive-env\Scripts\activate.bat
On Windows (PowerShell):
python -m venv olive-env
olive-env\Scripts\Activate.ps1
You can replace olive-env
with any path you want. A new folder will be created at the specified path to contain the virtual environment.
Please refer to the python documentation for more information on how to create and manage virtual environments.