This document describes the step-by-step instructions for reproducing PyTorch BlendCNN with IPEX backend tuning (with MRPC dataset) results with Intel® Neural Compressor.
cd examples/pytorch/nlp/blendcnn/quantization/ptq/ipex
pip install -r requirements.txt
Download BERT-Base, Uncased and GLUE MRPC Benchmark Datasets
mkdir models/ && mv uncased_L-12_H-768_A-12.zip models/
cd models/ && unzip uncased_L-12_H-768_A-12.zip
# train blend CNN from scratch
python classify.py --model_config config/blendcnn/mrpc/train.json
After below steps, you can find the pre-trained model weights model_final.pt at ./models/
After downloading the datasets, you need to put datasets at ./MRPC/
, including:
ls MRPC/
dev_ids.tsv dev.tsv test.tsv train.tsv
bash run_quant.sh --input_model=/PATH/TO/models/ --dataset_location=/PATH/TO/MRPC/ --output_model=/DIR/TO/INT8_MODEL/
bash run_benchmark.sh --int8=true --mode=performance --batch_size=32 --input_model=/DIR/TO/INT8_MODEL/
bash run_benchmark.sh --int8=False --mode=performance --batch_size=32 --input_model=/PATH/TO/FP32_MODEL