Pytorch Code for our paper at IEEE BIBM 2023: Exploring Post-Training Quantization of Protein Language Models [arXiv]
The code was verified on Python-3.8.15, PyTorch-1.13.1, Transformers-4.27.1
pip install -r requirements.txt
Check PTQ4Protein at piecewise_quant/piecewise.py
- Entering Task Dir
cd structure_prediction/scripts
- Quantizing ESMFold Model
# only quantize model weights
python quant_weis.py
# only quantize model activations
python quant_acts.py
# quantize both model weights and activations
python quant_full.py
- Evaluating Quantized ESMFold Model
# evaluate quantization of model weights
python eval_quant_weis.py
# evaluate quantization of model activations
python eval_quant_acts.py
# evaluate quantization of both model weights and activations
python eval_quant_full.py
Evaluation results would be printed on the command-line and prediction results would be saved at ../data/output/
dir.
- Entering Task Dir
cd contact_prediction/scripts
- Quantizing ESM2 Model and Evaluating Quantized Model
# only quantize model weights
python quant_weis.py
# only quantize model activations
python quant_acts.py
# quantize both model weights and activations
python quant_full.py
Evaluation results would be printed on the command-line.
@inproceedings{peng2023protein,
title={Exploring Post-Training Quantization of Protein Language Models},
author={Peng, Shuang and Yang, Fei and Sun, Ning and Chen, Sheng and Jiang, Yanfeng and Pan, Aimin},
booktitle={2023 IEEE International Conference on Bioinformatics and Biomedicine (BIBM)},
year={2023},
organization={IEEE}
}
The work of PWLQ has given us great inspiration. Here is the code and paper of PWLQ.
https://github.com/jun-fang/PWLQ
PyTorch Code: Post-Training Piecewise Linear Quantization for Deep Neural Networks [Paper] [arXiv]