This repository provides a customizable and automated environment for developing and testing different quantization methods.
Customizable Quantization: The framework allows the definition and integration of custom quantization methods. It is designed to work seamlessly with pre-configured data pipelines.
Ease of Use: Built on PyTorch Lightning, providing a streamlined API that simplifies model management and training, while leveraging Lightning’s features for distributed training and logging.
Broad Model Support: Designed to support models across multiple domains, including Computer Vision, Natural Language Processing, and Audio, with flexibility for different architectures.
Modular and Hackable Design: The framework's modular architecture makes it easy to modify and extend, enabling straightforward customization for specific needs.
Instructions to setup framework:
Clone this repo with
git clone https://github.com/aifoundry-org/Quant.git
Install project dependencies (it is better to use wit virtual environment)
pip3 install -r requirements.txt
Config schema placed in src/config/config_schema.py
from src.config.config_loader import load_and_validate_config
config = load_and_validate_config("config/{PATH_TO_YOUR_CONFIG}")
from src.models.compose.composer import ModelComposer
composer = ModelComposer(config=config)
model = composer.compose()
from src.training.trainer import Trainer
trainer = Trainer(config=config)
from src.quantization.quantizer import Quantizer
quantizer = Quantizer(config=config)()
from src.data import YOURDATAMODULE
data = YOURDATAMODULE
qmodel = quantizer.quantize(model, in_place=True)
trainer.fit(qmodel, datamodule=data)
Not yet implemented.
Please refer to CONTRIBUTING.md
Model | Dataset | Method | QW | QA | Best Top-1 |
---|---|---|---|---|---|
Resnet-20 | CIFAR-10 | FP | - | - | 91.7% |
Resnet-20 | CIFAR-10 | RNIQ | 2 | - | 91.85% |
Resnet-20 | CIFAR-10 | link | 2 | - | 91.1% |