1 ---
2
3 language: en
4 license: apache-2.0
5 datasets:
6 - big_patent
7 tags:
8 - summarization
9 ---
10
11 # BigBirdPegasus model (large)
12
13 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.
14
15 BigBird was introduced in this [paper](https://arxiv.org/abs/2007.14062) and first released in this [repository](https://github.com/google-research/bigbird).
16
17 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.
18
19 ## Model description
20
21 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.
22
23 ## How to use
24
25 Here is how to use this model to get the features of a given text in PyTorch:
26
27 ```python
28 from transformers import BigBirdPegasusForConditionalGeneration, AutoTokenizer
29
30 tokenizer = AutoTokenizer.from_pretrained("google/bigbird-pegasus-large-bigpatent")
31
32 # by default encoder-attention is `block_sparse` with num_random_blocks=3, block_size=64
33 model = BigBirdPegasusForConditionalGeneration.from_pretrained("google/bigbird-pegasus-large-bigpatent")
34
35 # decoder attention type can't be changed & will be "original_full"
36 # you can change `attention_type` (encoder only) to full attention like this:
37 model = BigBirdPegasusForConditionalGeneration.from_pretrained("google/bigbird-pegasus-large-bigpatent", attention_type="original_full")
38
39 # you can change `block_size` & `num_random_blocks` like this:
40 model = BigBirdPegasusForConditionalGeneration.from_pretrained("google/bigbird-pegasus-large-bigpatent", block_size=16, num_random_blocks=2)
41
42 text = "Replace me by any text you'd like."
43 inputs = tokenizer(text, return_tensors='pt')
44 prediction = model.generate(**inputs)
45 prediction = tokenizer.batch_decode(prediction)
46 ```
47
48 ## Training Procedure
49
50 This checkpoint is obtained after fine-tuning `BigBirdPegasusForConditionalGeneration` for **summarization** on [big_patent](https://huggingface.co/datasets/big_patent) dataset.
51
52 ## BibTeX entry and citation info
53
54 ```tex
55 @misc{zaheer2021big,
56 title={Big Bird: Transformers for Longer Sequences},
57 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},
58 year={2021},
59 eprint={2007.14062},
60 archivePrefix={arXiv},
61 primaryClass={cs.LG}
62 }
63 ```
64