julien-c HF staff commited on
Commit
ca872f4
1 Parent(s): 55dceaa

Migrate model card from transformers-repo

Browse files

Read announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/mrm8488/electra-small-finetuned-squadv1/README.md

Files changed (1) hide show
  1. README.md +87 -0
README.md ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ ---
4
+
5
+ # Electra small ⚡ + SQuAD v1 ❓
6
+
7
+ [Electra-small-discriminator](https://huggingface.co/google/electra-small-discriminator) fine-tuned on [SQUAD v1.1 dataset](https://rajpurkar.github.io/SQuAD-explorer/explore/1.1/dev/) for **Q&A** downstream task.
8
+
9
+ ## Details of the downstream task (Q&A) - Model 🧠
10
+
11
+ **ELECTRA** is a new method for self-supervised language representation learning. It can be used to pre-train transformer networks using relatively little compute. ELECTRA models are trained to distinguish "real" input tokens vs "fake" input tokens generated by another neural network, similar to the discriminator of a [GAN](https://arxiv.org/pdf/1406.2661.pdf). At small scale, ELECTRA achieves strong results even when trained on a single GPU. At large scale, ELECTRA achieves state-of-the-art results on the [SQuAD 2.0](https://rajpurkar.github.io/SQuAD-explorer/) dataset.
12
+
13
+
14
+ ## Details of the downstream task (Q&A) - Dataset 📚
15
+
16
+ **S**tanford **Q**uestion **A**nswering **D**ataset (SQuAD) is a reading comprehension dataset, consisting of questions posed by crowdworkers on a set of Wikipedia articles, where the answer to every question is a segment of text, or span, from the corresponding reading passage, or the question might be unanswerable.
17
+ SQuAD v1.1 contains **100,000+** question-answer pairs on **500+** articles.
18
+
19
+ ## Model training 🏋️‍
20
+
21
+ The model was trained on a Tesla P100 GPU and 25GB of RAM with the following command:
22
+
23
+ ```bash
24
+ python transformers/examples/question-answering/run_squad.py \
25
+ --model_type electra \
26
+ --model_name_or_path 'google/electra-small-discriminator' \
27
+ --do_eval \
28
+ --do_train \
29
+ --do_lower_case \
30
+ --train_file '/content/dataset/train-v1.1.json' \
31
+ --predict_file '/content/dataset/dev-v1.1.json' \
32
+ --per_gpu_train_batch_size 16 \
33
+ --learning_rate 3e-5 \
34
+ --num_train_epochs 10 \
35
+ --max_seq_length 384 \
36
+ --doc_stride 128 \
37
+ --output_dir '/content/output' \
38
+ --overwrite_output_dir \
39
+ --save_steps 1000
40
+ ```
41
+
42
+ ## Test set Results 🧾
43
+
44
+ | Metric | # Value |
45
+ | ------ | --------- |
46
+ | **EM** | **77.70** |
47
+ | **F1** | **85.74** |
48
+ | **Size**| **50 MB** |
49
+
50
+ Very good metrics for such a "small" model!
51
+
52
+ ```json
53
+
54
+ {
55
+ 'exact': 77.70104068117313,
56
+ 'f1': 85.73991234187997,
57
+ 'total': 10570,
58
+ 'HasAns_exact': 77.70104068117313,
59
+ 'HasAns_f1': 85.73991234187997,
60
+ 'HasAns_total': 10570,
61
+ 'best_exact': 77.70104068117313,
62
+ 'best_exact_thresh': 0.0,
63
+ 'best_f1': 85.73991234187997,
64
+ 'best_f1_thresh': 0.0
65
+ }
66
+ ```
67
+
68
+ ### Model in action 🚀
69
+
70
+ Fast usage with **pipelines**:
71
+
72
+ ```python
73
+ from transformers import pipeline
74
+
75
+ QnA_pipeline = pipeline('question-answering', model='mrm8488/electra-small-finetuned-squadv1')
76
+ QnA_pipeline({
77
+ 'context': 'A new strain of flu that has the potential to become a pandemic has been identified in China by scientists.',
78
+ 'question': 'What has been discovered by scientists from China ?'
79
+ })
80
+
81
+ # Output:
82
+ {'answer': 'A new strain of flu', 'end': 19, 'score': 0.7950334108113424, 'start': 0}
83
+ ```
84
+
85
+ > Created by [Manuel Romero/@mrm8488](https://twitter.com/mrm8488) | [LinkedIn](https://www.linkedin.com/in/manuel-romero-cs/)
86
+
87
+ > Made with <span style="color: #e25555;">&hearts;</span> in Spain