Example Notebooks¶
AIMET’s end-to-end examples are provided as Jupyter Notebooks designed to help you:
Get familiar with the AIMET APIs
Learn how to apply AIMET to pre-trained models from PyTorch, ONNX, and TensorFlow frameworks
Understand and implement AIMET’s quantization and compression techniques
For a deeper dive into these techniques, refer to the Optimization User Guide. For detailed API documentation, see the API Reference, see API reference
Browse the notebooks¶
The tables below provide links to viewable HTML versions of Jupyter Notebooks that showcase AIMET’s quantization and compression features.
Following the tables, you’ll find step-by-step instructions on how to run these notebooks locally or in your preferred environment.
Model Quantization Examples
Features |
ONNX |
PyTorch |
TensorFlow |
---|---|---|---|
Quantization simulation (QuantSim) |
|||
Quantization-aware training (QAT) |
Not implemented. |
||
Cross-layer equalization (CLE) |
|||
Adaptive rounding (AdaRound) |
|||
Automatic quantization (AutoQuant) |
Not implemented. |
||
Automatic mixed precision (AMP) |
|||
BatchNorm re-estimation |
Not implemented. |
||
Quant analyzer |
Not implemented. |
Model Compression Examples
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 your local repository directory and launch your chosen jupyter notebook (.ipynb extension):
Model quantization notebooks
Examples/onnx/quantization/
Examples/torch/quantization/
Examples/tensorflow/quantization/keras/
Model compression notebooks
Examples/torch/compression/
Follow the instructions in the notebook to execute the code.