Please find the information about preprocessing, training and full details of the MiniLM in the
original MiniLM repository.
Multilingual MiniLM uses the same tokenizer as XLM-R. But the Transformer architecture of our model is the same as BERT. We provide the fine-tuning code on XNLI based on
huggingface/transformers. Please replace
run_xnli.py in transformers with
ours to fine-tune multilingual MiniLM.
We evaluate the multilingual MiniLM on cross-lingual natural language inference benchmark (XNLI) and cross-lingual question answering benchmark (MLQA).
We evaluate our model on cross-lingual transfer from English to other languages. Following
Conneau et al. (2019), we select the best single model on the joint dev set of all the languages.
1# run fine-tuning on XNLI
2DATA_DIR=/{path_of_data}/
3OUTPUT_DIR=/{path_of_fine-tuned_model}/
4MODEL_PATH=/{path_of_pre-trained_model}/
5
6python ./examples/run_xnli.py --model_type minilm \
7 --output_dir ${OUTPUT_DIR} --data_dir ${DATA_DIR} \
8 --model_name_or_path microsoft/Multilingual-MiniLM-L12-H384 \
9 --tokenizer_name xlm-roberta-base \
10 --config_name ${MODEL_PATH}/multilingual-minilm-l12-h384-config.json \
11 --do_train \
12 --do_eval \
13 --max_seq_length 128 \
14 --per_gpu_train_batch_size 128 \
15 --learning_rate 5e-5 \
16 --num_train_epochs 5 \
17 --per_gpu_eval_batch_size 32 \
18 --weight_decay 0.001 \
19 --warmup_steps 500 \
20 --save_steps 1500 \
21 --logging_steps 1500 \
22 --eval_all_checkpoints \
23 --language en \
24 --fp16 \
25 --fp16_opt_level O2
Following
Lewis et al. (2019b), we adopt SQuAD 1.1 as training data and use MLQA English development data for early stopping.
1@misc{wang2020minilm,
2 title={MiniLM: Deep Self-Attention Distillation for Task-Agnostic Compression of Pre-Trained Transformers},
3 author={Wenhui Wang and Furu Wei and Li Dong and Hangbo Bao and Nan Yang and Ming Zhou},
4 year={2020},
5 eprint={2002.10957},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}