初始化项目,由ModelHub XC社区提供模型
Model: valhalla/distilbart-mnli-12-3 Source: Original Platform
This commit is contained in:
9
.gitattributes
vendored
Normal file
9
.gitattributes
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
59
README.md
Normal file
59
README.md
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
datasets:
|
||||
- mnli
|
||||
tags:
|
||||
- distilbart
|
||||
- distilbart-mnli
|
||||
pipeline_tag: zero-shot-classification
|
||||
---
|
||||
|
||||
# DistilBart-MNLI
|
||||
|
||||
distilbart-mnli is the distilled version of bart-large-mnli created using the **No Teacher Distillation** technique proposed for BART summarisation by Huggingface, [here](https://github.com/huggingface/transformers/tree/master/examples/seq2seq#distilbart).
|
||||
|
||||
We just copy alternating layers from `bart-large-mnli` and finetune more on the same data.
|
||||
|
||||
|
||||
| | matched acc | mismatched acc |
|
||||
| ------------------------------------------------------------------------------------ | ----------- | -------------- |
|
||||
| [bart-large-mnli](https://huggingface.co/facebook/bart-large-mnli) (baseline, 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 |
|
||||
|
||||
|
||||
This is a very simple and effective technique, as we can see the performance drop is very little.
|
||||
|
||||
Detailed performace trade-offs will be posted in this [sheet](https://docs.google.com/spreadsheets/d/1dQeUvAKpScLuhDV1afaPJRRAE55s2LpIzDVA5xfqxvk/edit?usp=sharing).
|
||||
|
||||
|
||||
## Fine-tuning
|
||||
If you want to train these models yourself, clone the [distillbart-mnli repo](https://github.com/patil-suraj/distillbart-mnli) and follow the steps below
|
||||
|
||||
Clone and install transformers from source
|
||||
```bash
|
||||
git clone https://github.com/huggingface/transformers.git
|
||||
pip install -qqq -U ./transformers
|
||||
```
|
||||
|
||||
Download MNLI data
|
||||
```bash
|
||||
python transformers/utils/download_glue_data.py --data_dir glue_data --tasks MNLI
|
||||
```
|
||||
|
||||
Create student model
|
||||
```bash
|
||||
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 \
|
||||
```
|
||||
|
||||
Start fine-tuning
|
||||
```bash
|
||||
python run_glue.py args.json
|
||||
```
|
||||
|
||||
You can find the logs of these trained models in this [wandb project](https://wandb.ai/psuraj/distilbart-mnli).
|
||||
56
config.json
Normal file
56
config.json
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"_num_labels": 3,
|
||||
"activation_dropout": 0.0,
|
||||
"activation_function": "gelu",
|
||||
"add_bias_logits": false,
|
||||
"add_final_layer_norm": false,
|
||||
"architectures": [
|
||||
"BartForSequenceClassification"
|
||||
],
|
||||
"attention_dropout": 0.1,
|
||||
"bos_token_id": 0,
|
||||
"classif_dropout": 0.0,
|
||||
"classifier_dropout": 0.0,
|
||||
"d_model": 1024,
|
||||
"decoder_attention_heads": 16,
|
||||
"decoder_ffn_dim": 4096,
|
||||
"decoder_layerdrop": 0.0,
|
||||
"decoder_layers": 3,
|
||||
"decoder_start_token_id": 2,
|
||||
"dropout": 0.1,
|
||||
"encoder_attention_heads": 16,
|
||||
"encoder_ffn_dim": 4096,
|
||||
"encoder_layerdrop": 0.0,
|
||||
"encoder_layers": 12,
|
||||
"eos_token_id": 2,
|
||||
"extra_pos_embeddings": 2,
|
||||
"finetuning_task": "mnli",
|
||||
"force_bos_token_to_be_generated": false,
|
||||
"forced_eos_token_id": 2,
|
||||
"gradient_checkpointing": false,
|
||||
"id2label": {
|
||||
"0": "contradiction",
|
||||
"1": "neutral",
|
||||
"2": "entailment"
|
||||
},
|
||||
"init_std": 0.02,
|
||||
"is_encoder_decoder": true,
|
||||
"label2id": {
|
||||
"contradiction": 0,
|
||||
"entailment": 2,
|
||||
"neutral": 1
|
||||
},
|
||||
"max_position_embeddings": 1024,
|
||||
"model_type": "bart",
|
||||
"normalize_before": false,
|
||||
"normalize_embedding": true,
|
||||
"num_hidden_layers": 12,
|
||||
"output_past": false,
|
||||
"pad_token_id": 1,
|
||||
"scale_embedding": false,
|
||||
"static_position_embeddings": false,
|
||||
"total_flos": 176191632140147712,
|
||||
"transformers_version": "4.7.0.dev0",
|
||||
"use_cache": true,
|
||||
"vocab_size": 50265
|
||||
}
|
||||
3
flax_model.msgpack
Normal file
3
flax_model.msgpack
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d6d86e46d68c4b30646d115e992fc049e5d56775b8068aaf21dc22c511bcf726
|
||||
size 1024706209
|
||||
50001
merges.txt
Normal file
50001
merges.txt
Normal file
File diff suppressed because it is too large
Load Diff
3
pytorch_model.bin
Normal file
3
pytorch_model.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:28712a32828482849e92109e3374b5430c871eea6cebfcd44633cb994148f9e7
|
||||
size 1024804435
|
||||
1
special_tokens_map.json
Normal file
1
special_tokens_map.json
Normal file
@@ -0,0 +1 @@
|
||||
{"bos_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "eos_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "unk_token": {"content": "<unk>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "sep_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "pad_token": {"content": "<pad>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "cls_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true}}
|
||||
1
tokenizer_config.json
Normal file
1
tokenizer_config.json
Normal file
@@ -0,0 +1 @@
|
||||
{"model_max_length": 1024}
|
||||
1
vocab.json
Normal file
1
vocab.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user