This repository provides an example of Quantization-Aware Training (QAT) using the PyTorch framework, specifically applied to the MNIST dataset. It demonstrates how to prepare, train, and convert a neural network model for efficient deployment on hardware with limited computational resources.
Please refer to PyTorch's official installation guide for instructions on installing PyTorch and torchvision.
Clone this repository to your local machine:
git clone git@github.com:james397520/Pytorch-Quantization-Example.git
cd Pytorch-Quantization-Example
Install the necessary Python packages:
pip install -r requirements.txt
To train the floating-point model using the MNIST dataset:
python mnist_float.py
cd QAT
python mnist_8bit.py
python mnist_4bit.py
python test_quantized_model.py
Contributions Welcome! Please open an issue or submit a pull request for any improvements or additions.