THU-MIG / torch-model-compression

针对pytorch模型的自动化模型结构分析和修改工具集,包含自动分析模型结构的模型压缩算法库
MIT License
240 stars 40 forks source link

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

Closed APeiZou closed 3 years ago

APeiZou commented 3 years ago

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

THUMIG commented 3 years ago

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