Commit
·
a580ea5
1
Parent(s):
3a477fd
Update README.md
Browse files
README.md
CHANGED
@@ -9,175 +9,53 @@ datasets:
|
|
9 |
tags:
|
10 |
- summarization
|
11 |
- translation
|
12 |
-
|
13 |
license: apache-2.0
|
14 |
-
inference: false
|
15 |
---
|
16 |
|
17 |
-
#
|
18 |
-
|
19 |
-
![model image](https://camo.githubusercontent.com/623b4dea0b653f2ad3f36c71ebfe749a677ac0a1/68747470733a2f2f6d69726f2e6d656469756d2e636f6d2f6d61782f343030362f312a44304a31674e51663876727255704b657944387750412e706e67)
|
20 |
-
|
21 |
-
# Table of Contents
|
22 |
-
|
23 |
-
1. [Model Details](#model-details)
|
24 |
-
2. [Uses](#uses)
|
25 |
-
3. [Bias, Risks, and Limitations](#bias-risks-and-limitations)
|
26 |
-
4. [Training Details](#training-details)
|
27 |
-
5. [Evaluation](#evaluation)
|
28 |
-
6. [Environmental Impact](#environmental-impact)
|
29 |
-
7. [Citation](#citation)
|
30 |
-
8. [Model Card Authors](#model-card-authors)
|
31 |
-
9. [How To Get Started With the Model](#how-to-get-started-with-the-model)
|
32 |
-
|
33 |
-
# Model Details
|
34 |
-
|
35 |
-
## Model Description
|
36 |
-
|
37 |
-
The developers of the Text-To-Text Transfer Transformer (T5) [write](https://ai.googleblog.com/2020/02/exploring-transfer-learning-with-t5.html):
|
38 |
-
|
39 |
-
> With T5, we propose reframing all NLP tasks into a unified text-to-text-format where the input and output are always text strings, in contrast to BERT-style models that can only output either a class label or a span of the input. Our text-to-text framework allows us to use the same model, loss function, and hyperparameters on any NLP task.
|
40 |
-
|
41 |
-
T5-11B is the checkpoint with 11 billion parameters.
|
42 |
-
|
43 |
-
- **Developed by:** Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J. Liu. See [associated paper](https://jmlr.org/papers/volume21/20-074/20-074.pdf) and [GitHub repo](https://github.com/google-research/text-to-text-transfer-transformer#released-model-checkpoints)
|
44 |
-
- **Model type:** Language model
|
45 |
-
- **Language(s) (NLP):** English, French, Romanian, German
|
46 |
-
- **License:** Apache 2.0
|
47 |
-
- **Related Models:** [All T5 Checkpoints](https://huggingface.co/models?search=t5)
|
48 |
-
- **Resources for more information:**
|
49 |
-
- [Research paper](https://jmlr.org/papers/volume21/20-074/20-074.pdf)
|
50 |
-
- [Google's T5 Blog Post](https://ai.googleblog.com/2020/02/exploring-transfer-learning-with-t5.html)
|
51 |
-
- [GitHub Repo](https://github.com/google-research/text-to-text-transfer-transformer)
|
52 |
-
- [Hugging Face T5 Docs](https://huggingface.co/docs/transformers/model_doc/t5)
|
53 |
-
|
54 |
-
# Uses
|
55 |
-
|
56 |
-
## Direct Use and Downstream Use
|
57 |
-
|
58 |
-
The developers write in a [blog post](https://ai.googleblog.com/2020/02/exploring-transfer-learning-with-t5.html) that the model:
|
59 |
-
|
60 |
-
> 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.
|
61 |
-
|
62 |
-
See the [blog post](https://ai.googleblog.com/2020/02/exploring-transfer-learning-with-t5.html) and [research paper](https://jmlr.org/papers/volume21/20-074/20-074.pdf) for further details.
|
63 |
-
|
64 |
-
## Out-of-Scope Use
|
65 |
-
|
66 |
-
More information needed.
|
67 |
-
|
68 |
-
# Bias, Risks, and Limitations
|
69 |
-
|
70 |
-
More information needed.
|
71 |
-
|
72 |
-
## Recommendations
|
73 |
-
|
74 |
-
More information needed.
|
75 |
-
|
76 |
-
# Training Details
|
77 |
-
|
78 |
-
## Training Data
|
79 |
-
|
80 |
-
The model is pre-trained on the [Colossal Clean Crawled Corpus (C4)](https://www.tensorflow.org/datasets/catalog/c4), which was developed and released in the context of the same [research paper](https://jmlr.org/papers/volume21/20-074/20-074.pdf) as T5.
|
81 |
|
82 |
-
|
83 |
-
Thereby, the following datasets were being used for (1.) and (2.):
|
84 |
|
85 |
-
|
86 |
|
87 |
-
-
|
88 |
-
- [Wiki-DPR](https://huggingface.co/datasets/wiki_dpr)
|
89 |
-
|
90 |
-
|
91 |
-
2. **Datasets used for Supervised text-to-text language modeling objective**
|
92 |
-
|
93 |
-
- Sentence acceptability judgment
|
94 |
-
- CoLA [Warstadt et al., 2018](https://arxiv.org/abs/1805.12471)
|
95 |
-
- Sentiment analysis
|
96 |
-
- SST-2 [Socher et al., 2013](https://nlp.stanford.edu/~socherr/EMNLP2013_RNTN.pdf)
|
97 |
-
- Paraphrasing/sentence similarity
|
98 |
-
- MRPC [Dolan and Brockett, 2005](https://aclanthology.org/I05-5002)
|
99 |
-
- STS-B [Ceret al., 2017](https://arxiv.org/abs/1708.00055)
|
100 |
-
- QQP [Iyer et al., 2017](https://quoradata.quora.com/First-Quora-Dataset-Release-Question-Pairs)
|
101 |
-
- Natural language inference
|
102 |
-
- MNLI [Williams et al., 2017](https://arxiv.org/abs/1704.05426)
|
103 |
-
- QNLI [Rajpurkar et al.,2016](https://arxiv.org/abs/1606.05250)
|
104 |
-
- RTE [Dagan et al., 2005](https://link.springer.com/chapter/10.1007/11736790_9)
|
105 |
-
- CB [De Marneff et al., 2019](https://semanticsarchive.net/Archive/Tg3ZGI2M/Marneffe.pdf)
|
106 |
-
- Sentence completion
|
107 |
-
- COPA [Roemmele et al., 2011](https://www.researchgate.net/publication/221251392_Choice_of_Plausible_Alternatives_An_Evaluation_of_Commonsense_Causal_Reasoning)
|
108 |
-
- Word sense disambiguation
|
109 |
-
- WIC [Pilehvar and Camacho-Collados, 2018](https://arxiv.org/abs/1808.09121)
|
110 |
-
- Question answering
|
111 |
-
- MultiRC [Khashabi et al., 2018](https://aclanthology.org/N18-1023)
|
112 |
-
- ReCoRD [Zhang et al., 2018](https://arxiv.org/abs/1810.12885)
|
113 |
-
- BoolQ [Clark et al., 2019](https://arxiv.org/abs/1905.10044)
|
114 |
-
|
115 |
-
## Training Procedure
|
116 |
-
|
117 |
-
In their [abstract](https://jmlr.org/papers/volume21/20-074/20-074.pdf), the model developers write:
|
118 |
-
|
119 |
-
> In this paper, we explore the landscape of transfer learning techniques for NLP by introducing a unified framework that converts every language problem into a text-to-text format. Our systematic study compares pre-training objectives, architectures, unlabeled datasets, transfer approaches, and other factors on dozens of language understanding tasks.
|
120 |
-
|
121 |
-
The framework introduced, the T5 framework, involves a training procedure that brings together the approaches studied in the paper. See the [research paper](https://jmlr.org/papers/volume21/20-074/20-074.pdf) for further details.
|
122 |
-
|
123 |
-
# Evaluation
|
124 |
-
|
125 |
-
## Testing Data, Factors & Metrics
|
126 |
-
|
127 |
-
The developers evaluated the model on 24 tasks, see the [research paper](https://jmlr.org/papers/volume21/20-074/20-074.pdf) for full details.
|
128 |
-
|
129 |
-
## Results
|
130 |
-
|
131 |
-
For full results for T5-11B, see the [research paper](https://jmlr.org/papers/volume21/20-074/20-074.pdf), Table 14.
|
132 |
|
133 |
-
|
134 |
|
135 |
-
|
136 |
|
137 |
-
|
138 |
-
- **Hours used:** More information needed
|
139 |
-
- **Cloud Provider:** GCP
|
140 |
-
- **Compute Region:** More information needed
|
141 |
-
- **Carbon Emitted:** More information needed
|
142 |
|
143 |
-
|
144 |
|
145 |
-
|
146 |
|
147 |
-
```
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
|
|
|
|
|
|
157 |
}
|
158 |
-
```
|
159 |
-
|
160 |
-
**APA:**
|
161 |
-
- Raffel, C., Shazeer, N., Roberts, A., Lee, K., Narang, S., Matena, M., ... & Liu, P. J. (2020). Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 21(140), 1-67.
|
162 |
-
|
163 |
-
# Model Card Authors
|
164 |
-
|
165 |
-
This model card was written by the team at Hugging Face.
|
166 |
|
167 |
-
#
|
168 |
-
|
169 |
-
|
|
|
|
|
170 |
|
171 |
-
|
172 |
-
|
|
|
173 |
|
174 |
-
|
175 |
-
t5 = transformers.T5ForConditionalGeneration.from_pretrained('t5-11b', use_cdn = False)
|
176 |
```
|
177 |
-
|
178 |
-
Secondly, a single GPU will most likely not have enough memory to even load the model into memory as the weights alone amount to over 40 GB.
|
179 |
-
- Model parallelism has to be used here to overcome this problem as is explained in this [PR](https://github.com/huggingface/transformers/pull/3578).
|
180 |
-
- DeepSpeed's ZeRO-Offload is another approach as explained in this [post](https://github.com/huggingface/transformers/issues/9996).
|
181 |
-
|
182 |
-
See the [Hugging Face T5](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5Model) docs and a [Colab Notebook](https://colab.research.google.com/github/google-research/text-to-text-transfer-transformer/blob/main/notebooks/t5-trivia.ipynb) created by the model developers for more context.
|
183 |
-
|
|
|
9 |
tags:
|
10 |
- summarization
|
11 |
- translation
|
12 |
+
- endpoints-template
|
13 |
license: apache-2.0
|
|
|
14 |
---
|
15 |
|
16 |
+
# Fork of [t5-11b](https://huggingface.co/t5-11b)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
+
> This is fork of [t5-11b](https://huggingface.co/t5-11b) implementing a custom `handler.py` as an example for how to use `t5-11b` with [inference-endpoints](https://hf.co/inference-endpoints) on a single NVIDIA T4.
|
|
|
19 |
|
20 |
+
---
|
21 |
|
22 |
+
# Model Card for T5 11B - fp16
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
+
![model image](https://camo.githubusercontent.com/623b4dea0b653f2ad3f36c71ebfe749a677ac0a1/68747470733a2f2f6d69726f2e6d656469756d2e636f6d2f6d61782f343030362f312a44304a31674e51663876727255704b657944387750412e706e67)
|
25 |
|
26 |
+
# Use with Inference Endpoints
|
27 |
|
28 |
+
Hugging Face Inference endpoints can be used with an HTTP client in any language. We will use Python and the `requests` library to send our requests. (make your you have it installed `pip install requests`)
|
|
|
|
|
|
|
|
|
29 |
|
30 |
+
![result](res.png)
|
31 |
|
32 |
+
## Send requests with Pyton
|
33 |
|
34 |
+
```python
|
35 |
+
import json
|
36 |
+
import requests as r
|
37 |
+
|
38 |
+
ENDPOINT_URL=""# url of your endpoint
|
39 |
+
HF_TOKEN=""
|
40 |
+
|
41 |
+
# payload samples
|
42 |
+
regular_payload = { "inputs": "" }
|
43 |
+
parameter_payload = {
|
44 |
+
"inputs": "Can you please let us know more details about your ",
|
45 |
+
"parameters" : {
|
46 |
+
"num_beams": 5,
|
47 |
+
}
|
48 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
+
# HTTP headers for authorization
|
51 |
+
headers= {
|
52 |
+
"Authorization": f"Bearer {HF_TOKEN}",
|
53 |
+
"Content-Type": "application/json"
|
54 |
+
}
|
55 |
|
56 |
+
# send request
|
57 |
+
response = r.post(ENDPOINT_URL, headers=headers, json=paramter_payload)
|
58 |
+
generated_text = response.json()
|
59 |
|
60 |
+
print(generated_text)
|
|
|
61 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|