thanhdeptrai2003
commited on
Commit
•
091ef26
1
Parent(s):
6e36386
Upload 8 files
Browse files- README.md +45 -0
- config.json +32 -0
- flax_model.msgpack +3 -0
- generation_config.json +7 -0
- model.safetensors +3 -0
- pytorch_model.bin +3 -0
- spiece.model +3 -0
- tokenizer.json +0 -0
README.md
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language: en
|
4 |
+
---
|
5 |
+
|
6 |
+
# LongT5 (local attention, base-sized model)
|
7 |
+
|
8 |
+
LongT5 model pre-trained on English language. The model was introduced in the paper [LongT5: Efficient Text-To-Text Transformer for Long Sequences](https://arxiv.org/pdf/2112.07916.pdf) by Guo et al. and first released in [the LongT5 repository](https://github.com/google-research/longt5). All the model architecture and configuration can be found in [Flaxformer repository](https://github.com/google/flaxformer) which uses another Google research project repository [T5x](https://github.com/google-research/t5x).
|
9 |
+
|
10 |
+
Disclaimer: The team releasing LongT5 did not write a model card for this model so this model card has been written by the Hugging Face team.
|
11 |
+
|
12 |
+
## Model description
|
13 |
+
LongT5 model is an encoder-decoder transformer pre-trained in a text-to-text denoising generative setting ([Pegasus-like generation pre-training](https://arxiv.org/pdf/1912.08777.pdf)). LongT5 model is an extension of [T5 model](https://arxiv.org/pdf/1910.10683.pdf), and it enables using one of the two different efficient attention mechanisms - (1) Local attention, or (2) Transient-Global attention. The usage of attention sparsity patterns allows the model to efficiently handle input sequence.
|
14 |
+
|
15 |
+
LongT5 is particularly effective when fine-tuned for text generation (summarization, question answering) which requires handling long input sequences (up to 16,384 tokens).
|
16 |
+
|
17 |
+
|
18 |
+
## Intended uses & limitations
|
19 |
+
|
20 |
+
The model is mostly meant to be fine-tuned on a supervised dataset. See the [model hub](https://huggingface.co/models?search=longt5) to look for fine-tuned versions on a task that interests you.
|
21 |
+
|
22 |
+
### How to use
|
23 |
+
|
24 |
+
```python
|
25 |
+
from transformers import AutoTokenizer, LongT5Model
|
26 |
+
|
27 |
+
tokenizer = AutoTokenizer.from_pretrained("google/long-t5-local-base")
|
28 |
+
model = LongT5Model.from_pretrained("google/long-t5-local-base")
|
29 |
+
|
30 |
+
inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
|
31 |
+
outputs = model(**inputs)
|
32 |
+
|
33 |
+
last_hidden_states = outputs.last_hidden_state
|
34 |
+
```
|
35 |
+
|
36 |
+
### BibTeX entry and citation info
|
37 |
+
|
38 |
+
```bibtex
|
39 |
+
@article{guo2021longt5,
|
40 |
+
title={LongT5: Efficient Text-To-Text Transformer for Long Sequences},
|
41 |
+
author={Guo, Mandy and Ainslie, Joshua and Uthus, David and Ontanon, Santiago and Ni, Jianmo and Sung, Yun-Hsuan and Yang, Yinfei},
|
42 |
+
journal={arXiv preprint arXiv:2112.07916},
|
43 |
+
year={2021}
|
44 |
+
}
|
45 |
+
```
|
config.json
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "Stancld/LongT5-Local-Base",
|
3 |
+
"architectures": [
|
4 |
+
"LongT5ForConditionalGeneration"
|
5 |
+
],
|
6 |
+
"d_ff": 2048,
|
7 |
+
"d_kv": 64,
|
8 |
+
"d_model": 768,
|
9 |
+
"decoder_start_token_id": 0,
|
10 |
+
"dropout_rate": 0.1,
|
11 |
+
"encoder_attention_type": "local",
|
12 |
+
"eos_token_id": 1,
|
13 |
+
"feed_forward_proj": "gated-gelu",
|
14 |
+
"initializer_factor": 1.0,
|
15 |
+
"is_encoder_decoder": true,
|
16 |
+
"layer_norm_epsilon": 1e-06,
|
17 |
+
"local_radius": 127,
|
18 |
+
"model_type": "longt5",
|
19 |
+
"n_positions": 4096,
|
20 |
+
"num_decoder_layers": 12,
|
21 |
+
"num_heads": 12,
|
22 |
+
"num_layers": 12,
|
23 |
+
"output_past": true,
|
24 |
+
"pad_token_id": 0,
|
25 |
+
"relative_attention_max_distance": 128,
|
26 |
+
"relative_attention_num_buckets": 32,
|
27 |
+
"tie_word_embeddings": false,
|
28 |
+
"torch_dtype": "float32",
|
29 |
+
"transformers_version": "4.19.0.dev0",
|
30 |
+
"use_cache": true,
|
31 |
+
"vocab_size": 32128
|
32 |
+
}
|
flax_model.msgpack
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5a2a19e78d4ea8e3161c249a76fa1bba0397921f47762e2ce505094c486cef1a
|
3 |
+
size 134
|
generation_config.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"decoder_start_token_id": 0,
|
4 |
+
"eos_token_id": 1,
|
5 |
+
"pad_token_id": 0,
|
6 |
+
"transformers_version": "4.27.0.dev0"
|
7 |
+
}
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5d0736958f83821fd8828d9c498ec2e339e263a71a4ac322cdb50e5fe50a17e2
|
3 |
+
size 134
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1f7ca42daf7605436fb82c21d5bad41daab81bcb05712c33c98dd34e37961519
|
3 |
+
size 134
|
spiece.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:494e3f78adee7d47cd481574567a67f49e77a88ee4ecf720909e0c8834cb200d
|
3 |
+
size 131
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|