vasudevgupta
commited on
Commit
•
3c5b601
1
Parent(s):
4337508
add ckpt-300000
Browse files- README.md +60 -0
- config.json +39 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- spiece.model +3 -0
- tokenizer_config.json +1 -0
README.md
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
|
3 |
+
language: en
|
4 |
+
license: apache-2.0
|
5 |
+
datasets:
|
6 |
+
- scientific_papers
|
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-pubmed")
|
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-pubmed", 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-pubmed", 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(input_ids=input_ids, num_beams=5, length_penalty=0.8)
|
42 |
+
prediction = tokenizer.batch_decode(prediction)
|
43 |
+
```
|
44 |
+
|
45 |
+
## Training Procedure
|
46 |
+
|
47 |
+
This checkpoint is obtained after fine-tuning `BigBirdPegasusForConditionalGeneration` for **summarization** on **pubmed dataset** from [scientific_papers](https://huggingface.co/datasets/scientific_papers).
|
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 |
+
```
|
config.json
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"activation_dropout": 0.0,
|
3 |
+
"activation_function": "gelu_fast",
|
4 |
+
"architectures": [
|
5 |
+
"BigBirdPegasusForConditionalGeneration"
|
6 |
+
],
|
7 |
+
"attention_dropout": 0.0,
|
8 |
+
"attention_type": "block_sparse",
|
9 |
+
"block_size": 64,
|
10 |
+
"bos_token_id": 2,
|
11 |
+
"classifier_dropout": 0.0,
|
12 |
+
"d_model": 1024,
|
13 |
+
"decoder_attention_heads": 16,
|
14 |
+
"decoder_ffn_dim": 4096,
|
15 |
+
"decoder_layerdrop": 0.0,
|
16 |
+
"decoder_layers": 16,
|
17 |
+
"decoder_start_token_id": 2,
|
18 |
+
"dropout": 0.1,
|
19 |
+
"encoder_attention_heads": 16,
|
20 |
+
"encoder_ffn_dim": 4096,
|
21 |
+
"encoder_layerdrop": 0.0,
|
22 |
+
"encoder_layers": 16,
|
23 |
+
"eos_token_id": 1,
|
24 |
+
"gradient_checkpointing": false,
|
25 |
+
"init_std": 0.02,
|
26 |
+
"is_encoder_decoder": true,
|
27 |
+
"max_position_embeddings": 4096,
|
28 |
+
"model_type": "bigbird_pegasus",
|
29 |
+
"num_hidden_layers": 16,
|
30 |
+
"num_random_blocks": 3,
|
31 |
+
"pad_token_id": 0,
|
32 |
+
"scale_embedding": true,
|
33 |
+
"transformers_version": "4.5.0.dev0",
|
34 |
+
"use_bias": false,
|
35 |
+
"use_cache": true,
|
36 |
+
"vocab_size": 96103,
|
37 |
+
"num_beams": 5,
|
38 |
+
"length_penalty": 0.8
|
39 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:52f2ed5790404860ca352a9572967a3e459662a10de13a52dda3805e94b1852c
|
3 |
+
size 2308148159
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"bos_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "eos_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "unk_token": {"content": "<unk>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "sep_token": {"content": "[SEP]", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "pad_token": {"content": "<pad>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "cls_token": {"content": "[CLS]", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "mask_token": {"content": "[MASK]", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true}}
|
spiece.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fe1b40df7e8825709c0172639c47338a68d5622e9e3b6cc0fae516537cae738b
|
3 |
+
size 1915455
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"bos_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "eos_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "unk_token": {"content": "<unk>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "pad_token": {"content": "<pad>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "sep_token": {"content": "[SEP]", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "mask_token": {"content": "[MASK]", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "cls_token": {"content": "[CLS]", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}}
|