maorivgi
commited on
Commit
•
b8c8c2e
1
Parent(s):
0ca1f11
initial commit
Browse files- README.md +64 -0
- config.json +9 -0
- tokenizer_config.json +5 -0
README.md
CHANGED
@@ -1,3 +1,67 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
language: en
|
4 |
---
|
5 |
+
|
6 |
+
# T5(v1.1)-SLED (SLiding-Encoder and Decoder, base-sized model)
|
7 |
+
|
8 |
+
SLED models use pretrained, short-range encoder-decoder models, and apply them over
|
9 |
+
long-text inputs by splitting the input into multiple overlapping chunks, encoding each independently and perform fusion-in-decoder
|
10 |
+
|
11 |
+
## Model description
|
12 |
+
|
13 |
+
This SLED model is based on the T5(V1.1) model, which is described in its [model card](https://huggingface.co/google/t5-v1_1-base).
|
14 |
+
|
15 |
+
The developers write in a [blog post](https://ai.googleblog.com/2020/02/exploring-transfer-learning-with-t5.html) that the T5 model:
|
16 |
+
> Our text-to-text framework allows us to use the same model, loss function, and hyperparameters on any NLP task, including machine translation, document summarization, question answering, and classification tasks (e.g., sentiment analysis). We can even apply T5 to regression tasks by training it to predict the string representation of a number instead of the number itself.
|
17 |
+
T5 v1.1 includes several improvments on top of the original checkpoint. see its card for details
|
18 |
+
|
19 |
+
## Intended uses & limitations
|
20 |
+
|
21 |
+
You can use the raw model for text infilling. However, the model is mostly meant to be fine-tuned on a supervised dataset.
|
22 |
+
|
23 |
+
### How to use
|
24 |
+
To use the model, you first have to get a local copy of the SLED model from the [official repository](https://github.com/Mivg/SLED/blob/main/README.md).
|
25 |
+
|
26 |
+
Here is how to use this model in PyTorch:
|
27 |
+
|
28 |
+
```python
|
29 |
+
from sled import SledTokenizer, SledModel
|
30 |
+
tokenizer = SledTokenizer.from_pretrained('tau/t5-v1_1-base-sled')
|
31 |
+
model = SledModel.from_pretrained('tau/t5-v1_1-base-sled')
|
32 |
+
inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
|
33 |
+
outputs = model(**inputs)
|
34 |
+
last_hidden_states = outputs.last_hidden_state
|
35 |
+
```
|
36 |
+
You can also replace SledModel by SledModelForConditionalGeneration for Seq2Seq generation
|
37 |
+
|
38 |
+
In case you wish to apply SLED on a task containing a prefix (e.g. question) which should be given as a context to
|
39 |
+
every chunk, you can pass the `prefix_length` tensor input as well (A LongTensor in the length of the batch size).
|
40 |
+
|
41 |
+
Sled is fully compatible with the AutoClasses (AutoTokenizer, AutoConfig, AutoModel
|
42 |
+
and AutoModelForCausalLM) and can be loaded using the from_pretrained methods
|
43 |
+
|
44 |
+
### BibTeX entry and citation info
|
45 |
+
|
46 |
+
Please cite both the SLED [paper](https://arxiv.org/abs/2208.00748.pdf) and the T5 [paper](https://arxiv.org/pdf/1910.10683.pdf) by Raffel et al
|
47 |
+
|
48 |
+
```bibtex
|
49 |
+
@inproceedings{Ivgi2022EfficientLU,
|
50 |
+
title={Efficient Long-Text Understanding with Short-Text Models},
|
51 |
+
author={Maor Ivgi and Uri Shaham and Jonathan Berant},
|
52 |
+
year={2022}
|
53 |
+
}
|
54 |
+
```
|
55 |
+
|
56 |
+
```bibtex
|
57 |
+
@article{2020t5,
|
58 |
+
author = {Colin Raffel and Noam Shazeer and Adam Roberts and Katherine Lee and Sharan Narang and Michael Matena and Yanqi Zhou and Wei Li and Peter J. Liu},
|
59 |
+
title = {Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer},
|
60 |
+
journal = {Journal of Machine Learning Research},
|
61 |
+
year = {2020},
|
62 |
+
volume = {21},
|
63 |
+
number = {140},
|
64 |
+
pages = {1-67},
|
65 |
+
url = {http://jmlr.org/papers/v21/20-074.html}
|
66 |
+
}
|
67 |
+
```
|
config.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"model_type": "tau/sled",
|
3 |
+
"underlying_config": "google/t5-v1_1-base",
|
4 |
+
"context_size": 256,
|
5 |
+
"window_fraction": 0.5,
|
6 |
+
"prepend_prefix": true,
|
7 |
+
"encode_prefix": true,
|
8 |
+
"sliding_method": "dynamic"
|
9 |
+
}
|
tokenizer_config.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"tokenizer_class": "SledTokenizer",
|
3 |
+
"base_tokenizer": "google/t5-v1_1-base",
|
4 |
+
"model_max_length": 16384
|
5 |
+
}
|