s4sarath commited on
Commit
8be0c26
1 Parent(s): f4e50dc

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +158 -0
README.md ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - exbert
4
+
5
+ language: en
6
+ license: apache-2.0
7
+ datasets:
8
+ - bookcorpus
9
+ - wikipedia
10
+ ---
11
+
12
+ # ALBERT Base v1
13
+
14
+ Pretrained model on English language using a masked language modeling (MLM) objective. It was introduced in
15
+ [this paper](https://arxiv.org/abs/1909.11942) and first released in
16
+ [this repository](https://github.com/google-research/albert). This model, as all ALBERT models, is uncased: it does not make a difference
17
+ between english and English.
18
+
19
+ Disclaimer: The team releasing ALBERT did not write a model card for this model so this model card has been written by
20
+ the Hugging Face team.
21
+
22
+ ## Model description
23
+
24
+ ALBERT is a transformers model pretrained on a large corpus of English data in a self-supervised fashion. This means it
25
+ was pretrained on the raw texts only, with no humans labelling them in any way (which is why it can use lots of
26
+ publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely, it
27
+ was pretrained with two objectives:
28
+
29
+ - Masked language modeling (MLM): taking a sentence, the model randomly masks 15% of the words in the input then run
30
+ the entire masked sentence through the model and has to predict the masked words. This is different from traditional
31
+ recurrent neural networks (RNNs) that usually see the words one after the other, or from autoregressive models like
32
+ GPT which internally mask the future tokens. It allows the model to learn a bidirectional representation of the
33
+ sentence.
34
+ - Sentence Ordering Prediction (SOP): ALBERT uses a pretraining loss based on predicting the ordering of two consecutive segments of text.
35
+
36
+ This way, the model learns an inner representation of the English language that can then be used to extract features
37
+ useful for downstream tasks: if you have a dataset of labeled sentences for instance, you can train a standard
38
+ classifier using the features produced by the ALBERT model as inputs.
39
+
40
+ ALBERT is particular in that it shares its layers across its Transformer. Therefore, all layers have the same weights. Using repeating layers results in a small memory footprint, however, the computational cost remains similar to a BERT-like architecture with the same number of hidden layers as it has to iterate through the same number of (repeating) layers.
41
+
42
+ This is the first version of the base model. Version 2 is different from version 1 due to different dropout rates, additional training data, and longer training. It has better results in nearly all downstream tasks.
43
+
44
+ This model has the following configuration:
45
+
46
+ - 12 repeating layers
47
+ - 128 embedding dimension
48
+ - 768 hidden dimension
49
+ - 12 attention heads
50
+ - 11M parameters
51
+
52
+ ## Intended uses & limitations
53
+
54
+ You can use the raw model for either masked language modeling or next sentence prediction, but it's mostly intended to
55
+ be fine-tuned on a downstream task. See the [model hub](https://huggingface.co/models?filter=albert) to look for
56
+ fine-tuned versions on a task that interests you.
57
+
58
+ Note that this model is primarily aimed at being fine-tuned on tasks that use the whole sentence (potentially masked)
59
+ to make decisions, such as sequence classification, token classification or question answering. For tasks such as text
60
+ generation you should look at model like GPT2.
61
+
62
+ ### How to use
63
+
64
+ You can use this model directly with a pipeline for masked language modeling:
65
+ In tf_transformers
66
+
67
+ ```python
68
+ from tf_transformers.models import AlbertModel
69
+ from transformers import AlbertTokenizer
70
+
71
+ tokenizer = AlbertTokenizer.from_pretrained('albert-base-v1')
72
+ model = AlbertModel.from_pretrained("albert-base-v1")
73
+
74
+ text = "Replace me by any text you'd like."
75
+ inputs_tf = {}
76
+ inputs = tokenizer(text, return_tensors='tf')
77
+
78
+
79
+ inputs_tf["input_ids"] = inputs["input_ids"]
80
+ inputs_tf["input_type_ids"] = inputs["token_type_ids"]
81
+ inputs_tf["input_mask"] = inputs["attention_mask"]
82
+ outputs_tf = model(inputs_tf)
83
+ ```
84
+
85
+
86
+ This bias will also affect all fine-tuned versions of this model.
87
+
88
+ ## Training data
89
+
90
+ The ALBERT model was pretrained on [BookCorpus](https://yknzhu.wixsite.com/mbweb), a dataset consisting of 11,038
91
+ unpublished books and [English Wikipedia](https://en.wikipedia.org/wiki/English_Wikipedia) (excluding lists, tables and
92
+ headers).
93
+
94
+ ## Training procedure
95
+
96
+ ### Preprocessing
97
+
98
+ The texts are lowercased and tokenized using SentencePiece and a vocabulary size of 30,000. The inputs of the model are
99
+ then of the form:
100
+
101
+ ```
102
+ [CLS] Sentence A [SEP] Sentence B [SEP]
103
+ ```
104
+
105
+ ### Training
106
+
107
+ The ALBERT procedure follows the BERT setup.
108
+
109
+ The details of the masking procedure for each sentence are the following:
110
+ - 15% of the tokens are masked.
111
+ - In 80% of the cases, the masked tokens are replaced by `[MASK]`.
112
+ - In 10% of the cases, the masked tokens are replaced by a random token (different) from the one they replace.
113
+ - In the 10% remaining cases, the masked tokens are left as is.
114
+
115
+ ## Evaluation results
116
+
117
+ When fine-tuned on downstream tasks, the ALBERT models achieve the following results:
118
+
119
+ | | Average | SQuAD1.1 | SQuAD2.0 | MNLI | SST-2 | RACE |
120
+ |----------------|----------|----------|----------|----------|----------|----------|
121
+ |V2 |
122
+ |ALBERT-base |82.3 |90.2/83.2 |82.1/79.3 |84.6 |92.9 |66.8 |
123
+ |ALBERT-large |85.7 |91.8/85.2 |84.9/81.8 |86.5 |94.9 |75.2 |
124
+ |ALBERT-xlarge |87.9 |92.9/86.4 |87.9/84.1 |87.9 |95.4 |80.7 |
125
+ |ALBERT-xxlarge |90.9 |94.6/89.1 |89.8/86.9 |90.6 |96.8 |86.8 |
126
+ |V1 |
127
+ |ALBERT-base |80.1 |89.3/82.3 | 80.0/77.1|81.6 |90.3 | 64.0 |
128
+ |ALBERT-large |82.4 |90.6/83.9 | 82.3/79.4|83.5 |91.7 | 68.5 |
129
+ |ALBERT-xlarge |85.5 |92.5/86.1 | 86.1/83.1|86.4 |92.4 | 74.8 |
130
+ |ALBERT-xxlarge |91.0 |94.8/89.3 | 90.2/87.4|90.8 |96.9 | 86.5 |
131
+
132
+
133
+ ### BibTeX entry and citation info
134
+
135
+ ```bibtex
136
+ @article{DBLP:journals/corr/abs-1909-11942,
137
+ author = {Zhenzhong Lan and
138
+ Mingda Chen and
139
+ Sebastian Goodman and
140
+ Kevin Gimpel and
141
+ Piyush Sharma and
142
+ Radu Soricut},
143
+ title = {{ALBERT:} {A} Lite {BERT} for Self-supervised Learning of Language
144
+ Representations},
145
+ journal = {CoRR},
146
+ volume = {abs/1909.11942},
147
+ year = {2019},
148
+ url = {http://arxiv.org/abs/1909.11942},
149
+ archivePrefix = {arXiv},
150
+ eprint = {1909.11942},
151
+ timestamp = {Fri, 27 Sep 2019 13:04:21 +0200},
152
+ biburl = {https://dblp.org/rec/journals/corr/abs-1909-11942.bib},
153
+ bibsource = {dblp computer science bibliography, https://dblp.org}
154
+ }
155
+ ```
156
+ <a href="https://huggingface.co/exbert/?model=albert-base-v1">
157
+ <img width="300px" src="https://cdn-media.huggingface.co/exbert/button.png">
158
+ </a>