vasudevgupta commited on
Commit
32ba418
1 Parent(s): 9c05117

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +60 -0
README.md ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+
3
+ language: en
4
+ license: apache-2.0
5
+ datasets:
6
+ - big_patent
7
+
8
+ ---
9
+
10
+ # BigBirdPegasus model (large)
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
+ BigBird 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 BigBirdPegasusForConditionalGeneration, BigBirdPegasusTokenizer
28
+
29
+ # by default encoder-attention is `block_sparse` with num_random_blocks=3, block_size=64
30
+ model = BigBirdPegasusForConditionalGeneration.from_pretrained("google/bigbird-pegasus-large-bigpatent")
31
+
32
+ # decoder attention type can't be changed & will be "original_full"
33
+ # you can change `attention_type` (encoder only) to full attention like this:
34
+ model = BigBirdPegasusForConditionalGeneration.from_pretrained("google/bigbird-pegasus-large-bigpatent", attention_type="original_full")
35
+
36
+ # you can change `block_size` & `num_random_blocks` like this:
37
+ model = BigBirdPegasusForConditionalGeneration.from_pretrained("google/bigbird-pegasus-large-bigpatent", block_size=16, num_random_blocks=2)
38
+
39
+ text = "Replace me by any text you'd like."
40
+ inputs = tokenizer(text, return_tensors='pt')
41
+ prediction = model.generate(**inputs)
42
+ prediction = tokenizer.batch_decode(prediction)
43
+ ```
44
+
45
+ ## Training Procedure
46
+
47
+ This checkpoint is obtained after fine-tuning `BigBirdPegasusForConditionalGeneration` for **summarization** on [big_patent](https://huggingface.co/datasets/big_patent) dataset.
48
+
49
+ ## BibTeX entry and citation info
50
+
51
+ ```tex
52
+ @misc{zaheer2021big,
53
+ title={Big Bird: Transformers for Longer Sequences},
54
+ 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},
55
+ year={2021},
56
+ eprint={2007.14062},
57
+ archivePrefix={arXiv},
58
+ primaryClass={cs.LG}
59
+ }
60
+ ```