🚀 DistilBart - MNLI
DistilBart - MNLI是bart - large - mnli
的蒸餾版本,它採用了Huggingface為BART摘要任務提出的無教師蒸餾技術創建而成,具體可參考此處。該模型通過複製bart - large - mnli
的交替層,並在相同數據上進一步微調得到。
數據集和標籤信息
屬性 |
詳情 |
數據集 |
mnli |
標籤 |
distilbart、distilbart - mnli |
管道標籤 |
zero - shot - classification |
模型性能對比
模型 |
匹配準確率 |
不匹配準確率 |
[bart - large - mnli](https://huggingface.co/facebook/bart - large - mnli) (基線模型, 12 - 12) |
89.9 |
90.01 |
[distilbart - mnli - 12 - 1](https://huggingface.co/valhalla/distilbart - mnli - 12 - 1) |
87.08 |
87.5 |
[distilbart - mnli - 12 - 3](https://huggingface.co/valhalla/distilbart - mnli - 12 - 3) |
88.1 |
88.19 |
[distilbart - mnli - 12 - 6](https://huggingface.co/valhalla/distilbart - mnli - 12 - 6) |
89.19 |
89.01 |
[distilbart - mnli - 12 - 9](https://huggingface.co/valhalla/distilbart - mnli - 12 - 9) |
89.56 |
89.52 |
可以看出,這種蒸餾技術非常簡單且有效,模型性能下降很小。詳細的性能權衡信息可查看此表格。
📦 安裝指南
如果你想自己訓練這些模型,可克隆[distillbart - mnli倉庫](https://github.com/patil - suraj/distillbart - mnli),並按照以下步驟操作:
- 從源代碼克隆並安裝transformers庫
git clone https://github.com/huggingface/transformers.git
pip install -qqq -U ./transformers
- 下載MNLI數據
python transformers/utils/download_glue_data.py --data_dir glue_data --tasks MNLI
💻 使用示例
基礎用法
創建學生模型
python create_student.py \
--teacher_model_name_or_path facebook/bart-large-mnli \
--student_encoder_layers 12 \
--student_decoder_layers 6 \
--save_path student-bart-mnli-12-6 \
高級用法
開始微調
python run_glue.py args.json
訓練模型的日誌可在[此wandb項目](https://wandb.ai/psuraj/distilbart - mnli)中查看。