1git clone https://github.com/vuiseng9/optimum-intel
2cd optimum-intel
3pip install -e .[openvino,nncf]
4
5cd examples/openvino/question-answering/
6pip install -r requirements.txt
7
8pip install wandb # optional
1
2NNCFCFG=/path/to/openvino_config.json
3MASTER_PORT=<PORTID>
4RUNID=<RUN_IDENTIFIER>
5OUTDIR=/path/to/saved_model
6
7NEPOCH=15
8
9python run_qa.py \
10 --model_name_or_path bert-base-uncased \
11 --dataset_name squad \
12 --teacher_model_or_path bert-large-uncased-whole-word-masking-finetuned-squad \
13 --distillation_weight 0.9 \
14 --do_eval \
15 --fp16 \
16 --do_train \
17 --learning_rate 3e-5 \
18 --num_train_epochs $NEPOCH \
19 --per_device_eval_batch_size 128 \
20 --per_device_train_batch_size 16 \
21 --max_seq_length 384 \
22 --doc_stride 128 \
23 --logging_steps 1 \
24 --evaluation_strategy steps \
25 --eval_steps 250 \
26 --save_steps 500 \
27 --overwrite_output_dir \
28 --run_name $RUNID \
29 --output_dir $OUTDIR \
30 --nncf_compression_config $NNCFCFG \
Global Step: 80000
F1: 90.272
EM: 83.728
Structured Sparsity (linear): 52.18%