vasudevgupta
commited on
Commit
•
215c99f
1
Parent(s):
37532b8
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: en
|
3 |
+
license: apache-2.0
|
4 |
+
datasets:
|
5 |
+
- bookcorpus
|
6 |
+
- wikipedia
|
7 |
+
- cc_news
|
8 |
+
---
|
9 |
+
|
10 |
+
# BigBird base model
|
11 |
+
|
12 |
+
BigBird, is a sparse-attention based transformer which extends Transformer based models, such as BERT to much longer sequences. Moreover, BigBird comes along with a theoretical understanding of the capabilities of a complete transformer that the sparse model can handle.
|
13 |
+
|
14 |
+
It is a pretrained model on English language using a masked language modeling (MLM) objective. It was introduced in this [paper](https://arxiv.org/abs/2007.14062) and first released in this [repository](https://github.com/google-research/bigbird).
|
15 |
+
|
16 |
+
Disclaimer: The team releasing BigBird did not write a model card for this model so this model card has been written by the Hugging Face team.
|
17 |
+
|
18 |
+
## Model description
|
19 |
+
|
20 |
+
BigBird relies on **block sparse attention** instead of normal attention (i.e. BERT's attention) and can handle sequences up to a length of 4096 at a much lower compute cost compared to BERT. It has achieved SOTA on various tasks involving very long sequences such as long documents summarization, question-answering with long contexts.
|
21 |
+
|
22 |
+
## How to use
|
23 |
+
|
24 |
+
Here is how to use this model to get the features of a given text in PyTorch:
|
25 |
+
|
26 |
+
```python
|
27 |
+
from transformers import BigBirdModel
|
28 |
+
|
29 |
+
# by default its in `block_sparse` mode with num_random_blocks=3, block_size=64
|
30 |
+
model = BigBirdModel.from_pretrained("google/bigbird-roberta-base")
|
31 |
+
|
32 |
+
# you can change `attention_type` to full attention like this:
|
33 |
+
model = BigBirdModel.from_pretrained("google/bigbird-roberta-base", attention_type="original_full")
|
34 |
+
|
35 |
+
# you can change `block_size` & `num_random_blocks` like this:
|
36 |
+
model = BigBirdModel.from_pretrained("google/bigbird-roberta-base", block_size=16, num_random_blocks=2)
|
37 |
+
|
38 |
+
text = "Replace me by any text you'd like."
|
39 |
+
encoded_input = tokenizer(text, return_tensors='pt')
|
40 |
+
output = model(**encoded_input)
|
41 |
+
```
|
42 |
+
|
43 |
+
## Training Data
|
44 |
+
|
45 |
+
This model is pre-trained on four publicly available datasets: **Books**, **CC-News**, **Stories** and **Wikipedia**. It used same sentencepiece vocabulary as RoBERTa (which is in turn borrowed from GPT2).
|
46 |
+
|
47 |
+
## Training Procedure
|
48 |
+
|
49 |
+
Document longer than 4096 were split into multiple documents and documents that were much smaller than 4096 were joined. Following the original BERT training, 15% of tokens were masked and model is trained to predict the mask.
|
50 |
+
|
51 |
+
Model is warm started from RoBERTa’s checkpoint.
|
52 |
+
|
53 |
+
## BibTeX entry and citation info
|
54 |
+
|
55 |
+
```tex
|
56 |
+
@misc{zaheer2021big,
|
57 |
+
title={Big Bird: Transformers for Longer Sequences},
|
58 |
+
author={Manzil Zaheer and Guru Guruganesh and Avinava Dubey and Joshua Ainslie and Chris Alberti and Santiago Ontanon and Philip Pham and Anirudh Ravula and Qifan Wang and Li Yang and Amr Ahmed},
|
59 |
+
year={2021},
|
60 |
+
eprint={2007.14062},
|
61 |
+
archivePrefix={arXiv},
|
62 |
+
primaryClass={cs.LG}
|
63 |
+
}
|
64 |
+
```
|