AIMET examples
AIMET examples are Jupyter Notebooks that are intended to:
Familiarize you with the AIMET APIs
Demonstrate how to apply AIMET to a model
Teach you how to use AIMET quantization and compression techniques
For a discussion of quantization techniques, see AIMET model quantization.
For a discussion of compression techniques, see AIMET model compression.
For the API reference, see:
AIMET PyTorch APIs for PyTorch
AIMET TensorFlow APIs for TensorFlow
AIMET ONNX APIs for ONNX
Browse the notebooks
The following tables provide links to viewable versions of the notebooks for AIMET quantization and compression features. Instructions after the tables describe how to run the notebooks.
Model Quantization Examples
Feature |
PyTorch |
TensorFlow |
ONNX |
---|---|---|---|
QuantSim / Quantization-Aware Training (QAT) |
Link (no training) |
||
QAT with Range Learning |
|||
Cross-Layer Equalization (CLE) |
|||
Adaptive Rounding (AdaRound) |
|||
AutoQuant |
Model Compression Examples
Feature |
PyTorch |
---|---|
Channel Pruning |
|
Spatial SVD |
|
Spatial SVD + Channel Pruning |
Running the notebooks
To run the notebooks, follow the instructions below.
1. Run the notebook server
Install the Jupyter metapackage using the following command. (Prepend the command with
sudo -H
if necessary to grant admin privilege.)python3 -m pip install jupyter
Start the notebook server as follows:
jupyter notebook --ip=* --no-browser &
The command generates and displays a URL in the terminal.
Copy and paste the URL into your browser.
Install AIMET and its dependencies using the instructions in AIMET installation.
3. Run the notebooks
Navigate to one of the following paths in the local repository directory and launch your chosen Jupyter Notebook (.ipynb extension):
Examples/torch/quantization/
Examples/torch/compression/
Examples/tensorflow/quantization/keras/
Follow the instructions in the notebook to execute the code.