gchhablani commited on
Commit
7b4636c
1 Parent(s): a701641

Add README.md

Browse files
Files changed (1) hide show
  1. README.md +110 -0
README.md ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ tags:
4
+ - exbert
5
+ - multiberts
6
+ license: apache-2.0
7
+ datasets:
8
+ - bookcorpus
9
+ - wikipedia
10
+ ---
11
+ # MultiBERTs Seed 12 (uncased)
12
+ Seed 12 pretrained BERT model on English language using a masked language modeling (MLM) objective. It was introduced in
13
+ [this paper](https://arxiv.org/pdf/2106.16163.pdf) and first released in
14
+ [this repository](https://github.com/google-research/language/tree/master/language/multiberts). This model is uncased: it does not make a difference
15
+ between english and English.
16
+
17
+ Disclaimer: The team releasing MultiBERTs did not write a model card for this model so this model card has been written by [gchhablani](https://hf.co/gchhablani).
18
+ ## Model description
19
+ MultiBERTs models are transformers model pretrained on a large corpus of English data in a self-supervised fashion. This means it
20
+ was pretrained on the raw texts only, with no humans labelling them in any way (which is why it can use lots of
21
+ publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely, it
22
+ was pretrained with two objectives:
23
+ - Masked language modeling (MLM): taking a sentence, the model randomly masks 15% of the words in the input then run
24
+ the entire masked sentence through the model and has to predict the masked words. This is different from traditional
25
+ recurrent neural networks (RNNs) that usually see the words one after the other, or from autoregressive models like
26
+ GPT which internally mask the future tokens. It allows the model to learn a bidirectional representation of the
27
+ sentence.
28
+ - Next sentence prediction (NSP): the models concatenates two masked sentences as inputs during pretraining. Sometimes
29
+ they correspond to sentences that were next to each other in the original text, sometimes not. The model then has to
30
+ predict if the two sentences were following each other or not.
31
+ This way, the model learns an inner representation of the English language that can then be used to extract features
32
+ useful for downstream tasks: if you have a dataset of labeled sentences for instance, you can train a standard
33
+ classifier using the features produced by the BERT model as inputs.
34
+ ## Intended uses & limitations
35
+ You can use the raw model for either masked language modeling or next sentence prediction, but it's mostly intended to
36
+ be fine-tuned on a downstream task. See the [model hub](https://huggingface.co/models?filter=bert) to look for
37
+ fine-tuned versions on a task that interests you.
38
+ Note that this model is primarily aimed at being fine-tuned on tasks that use the whole sentence (potentially masked)
39
+ to make decisions, such as sequence classification, token classification or question answering. For tasks such as text
40
+ generation you should look at model like GPT2.
41
+ ### How to use
42
+ Here is how to use this model to get the features of a given text in PyTorch:
43
+ ```python
44
+ from transformers import BertTokenizer, BertModel
45
+ tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
46
+ model = BertModel.from_pretrained("multiberts-seed-12")
47
+ text = "Replace me by any text you'd like."
48
+ encoded_input = tokenizer(text, return_tensors='pt')
49
+ output = model(**encoded_input)
50
+ ```
51
+ ### Limitations and bias
52
+ Even if the training data used for this model could be characterized as fairly neutral, this model can have biased
53
+ predictions. This bias will also affect all fine-tuned versions of this model. For an understanding of bias of this particular
54
+ checkpoint, please try out this checkpoint with the snippet present in the [Limitation and bias section](https://huggingface.co/bert-base-uncased#limitations-and-bias) of the [bert-base-uncased](https://huggingface.co/bert-base-uncased) checkpoint.
55
+
56
+ ## Training data
57
+ The MultiBERTs models were pretrained on [BookCorpus](https://yknzhu.wixsite.com/mbweb), a dataset consisting of 11,038
58
+ unpublished books and [English Wikipedia](https://en.wikipedia.org/wiki/English_Wikipedia) (excluding lists, tables and
59
+ headers).
60
+ ## Training procedure
61
+ ### Preprocessing
62
+ The texts are lowercased and tokenized using WordPiece and a vocabulary size of 30,000. The inputs of the model are
63
+ then of the form:
64
+ ```
65
+ [CLS] Sentence A [SEP] Sentence B [SEP]
66
+ ```
67
+ With probability 0.5, sentence A and sentence B correspond to two consecutive sentences in the original corpus and in
68
+ the other cases, it's another random sentence in the corpus. Note that what is considered a sentence here is a
69
+ consecutive span of text usually longer than a single sentence. The only constrain is that the result with the two
70
+ "sentences" has a combined length of less than 512 tokens.
71
+ The details of the masking procedure for each sentence are the following:
72
+ - 15% of the tokens are masked.
73
+ - In 80% of the cases, the masked tokens are replaced by `[MASK]`.
74
+ - In 10% of the cases, the masked tokens are replaced by a random token (different) from the one they replace.
75
+ - In the 10% remaining cases, the masked tokens are left as is.
76
+ ### Pretraining
77
+ The model was trained on 16 Cloud TPU v2 chips for two million steps with a batch size
78
+ of 256. The sequence length was set to 512 throughout. The optimizer
79
+ used is Adam with a learning rate of 1e-4, \\(\beta_{1} = 0.9\\) and \\(\beta_{2} = 0.999\\), a weight decay of 0.01,
80
+ learning rate warmup for 10,000 steps and linear decay of the learning rate after.
81
+ ### BibTeX entry and citation info
82
+ ```bibtex
83
+ @article{DBLP:journals/corr/abs-2106-16163,
84
+ author = {Thibault Sellam and
85
+ Steve Yadlowsky and
86
+ Jason Wei and
87
+ Naomi Saphra and
88
+ Alexander D'Amour and
89
+ Tal Linzen and
90
+ Jasmijn Bastings and
91
+ Iulia Turc and
92
+ Jacob Eisenstein and
93
+ Dipanjan Das and
94
+ Ian Tenney and
95
+ Ellie Pavlick},
96
+ title = {The MultiBERTs: {BERT} Reproductions for Robustness Analysis},
97
+ journal = {CoRR},
98
+ volume = {abs/2106.16163},
99
+ year = {2021},
100
+ url = {https://arxiv.org/abs/2106.16163},
101
+ eprinttype = {arXiv},
102
+ eprint = {2106.16163},
103
+ timestamp = {Mon, 05 Jul 2021 15:15:50 +0200},
104
+ biburl = {https://dblp.org/rec/journals/corr/abs-2106-16163.bib},
105
+ bibsource = {dblp computer science bibliography, https://dblp.org}
106
+ }
107
+ ```
108
+ <a href="https://huggingface.co/exbert/?model=multiberts">
109
+ <img width="300px" src="https://cdn-media.huggingface.co/exbert/button.png">
110
+ </a>