THU-MIG / torch-model-compression

针对pytorch模型的自动化模型结构分析和修改工具集,包含自动分析模型结构的模型压缩算法库

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to quantize and compress the trained model???

APeiZou opened this issue · comments

How to quantize and compress the trained model??????

You can load the model and call the torchslim.quantization.qat.QATSolver to do the quantization aware train,the model can be automatically converted into the tensorrt format.
The simple example is here
https://github.com/THU-MIG/torch-model-compression/blob/main/examples/torchslim/pytorch-cifar/qat.py
The source code is here
https://github.com/THU-MIG/torch-model-compression/blob/main/torchslim/quantizing/qat.py