ybelkada commited on
Commit
bef8395
1 Parent(s): 3c27a5f

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +310 -0
README.md ADDED
@@ -0,0 +1,310 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - sp
5
+ - ja
6
+ - pe
7
+ - hi
8
+ - fr
9
+ - ch
10
+ - be
11
+ - gu
12
+ - ge
13
+ - te
14
+ - it
15
+ - ar
16
+ - po
17
+ - ta
18
+ - ma
19
+ - ma
20
+ - or
21
+ - pa
22
+ - po
23
+ - ur
24
+ - ga
25
+ - he
26
+ - ko
27
+ - ca
28
+ - th
29
+ - du
30
+ - in
31
+ - vi
32
+ - bu
33
+ - fi
34
+ - ce
35
+ - la
36
+ - tu
37
+ - ru
38
+ - cr
39
+ - sw
40
+ - yo
41
+ - ku
42
+ - bu
43
+ - ma
44
+ - cz
45
+ - fi
46
+ - so
47
+ - ta
48
+ - sw
49
+ - si
50
+ - ka
51
+ - zh
52
+ - ig
53
+ - xh
54
+ - ro
55
+ - ha
56
+ - es
57
+ - sl
58
+ - li
59
+ - gr
60
+ - ne
61
+ - as
62
+ - no
63
+
64
+ tags:
65
+ - text2text-generation
66
+
67
+ datasets:
68
+ - svakulenk0/qrecc
69
+ - taskmaster2
70
+ - djaym7/wiki_dialog
71
+ - deepmind/code_contests
72
+ - lambada
73
+ - gsm8k
74
+ - aqua_rat
75
+ - esnli
76
+ - quasc
77
+ - qed
78
+
79
+
80
+ license: apache-2.0
81
+ ---
82
+
83
+ # Model Card for FLAN-T5 large
84
+
85
+ ![model image](https://s3.amazonaws.com/moonup/production/uploads/1666363435475-62441d1d9fdefb55a0b7d12c.png)
86
+
87
+ # Table of Contents
88
+
89
+ 0. [TL;DR](#TL;DR)
90
+ 1. [Model Details](#model-details)
91
+ 2. [Usage](#usage)
92
+ 3. [Uses](#uses)
93
+ 4. [Bias, Risks, and Limitations](#bias-risks-and-limitations)
94
+ 5. [Training Details](#training-details)
95
+ 6. [Evaluation](#evaluation)
96
+ 7. [Environmental Impact](#environmental-impact)
97
+ 8. [Citation](#citation)
98
+ 9. [Model Card Authors](#model-card-authors)
99
+
100
+ # TL;DR
101
+
102
+ If you already know T5, FLAN-T5 is just better at everything. For the same number of parameters, these models have been fine-tuned on more than 1000 additional tasks covering also more languages.
103
+ As mentioned in the first few lines of the abstract :
104
+ > Flan-PaLM 540B achieves state-of-the-art performance on several benchmarks, such as 75.2% on five-shot MMLU. We also publicly release Flan-T5 checkpoints,1 which achieve strong few-shot performance even compared to much larger models, such as PaLM 62B. Overall, instruction finetuning is a general method for improving the performance and usability of pretrained language models.
105
+
106
+ **Disclaimer**: Content from **this** model card has been written by the Hugging Face team, and parts of it were copy pasted from the [T5 model card](https://huggingface.co/t5-large).
107
+
108
+ # Model Details
109
+
110
+ ## Model Description
111
+
112
+
113
+ - **Model type:** Language model
114
+ - **Language(s) (NLP):** English, Spanish, Japanese, Persian, Hindi, French, Chinese, Bengali, Gujarati, German, Telugu, Italian, Arabic, Polish, Tamil, Marathi, Malayalam, Oriya, Panjabi, Portuguese, Urdu, Galician, Hebrew, Korean, Catalan, Thai, Dutch, Indonesian, Vietnamese, Bulgarian, Filipino, Central Khmer, Lao, Turkish, Russian, Croatian, Swedish, Yoruba, Kurdish, Burmese, Malay, Czech, Finnish, Somali, Tagalog, Swahili, Sinhala, Kannada, Zhuang, Igbo, Xhosa, Romanian, Haitian, Estonian, Slovak, Lithuanian, Greek, Nepali, Assamese, Norwegian
115
+ - **License:** Apache 2.0
116
+ - **Related Models:** [All FLAN-T5 Checkpoints](https://huggingface.co/models?search=flan-t5)
117
+ - **Original Checkpoints:** [All Original FLAN-T5 Checkpoints](https://github.com/google-research/t5x/blob/main/docs/models.md#flan-t5-checkpoints)
118
+ - **Resources for more information:**
119
+ - [Research paper](https://arxiv.org/pdf/2210.11416.pdf)
120
+ - [GitHub Repo](https://github.com/google-research/t5x)
121
+ - [Hugging Face FLAN-T5 Docs (Similar to T5) ](https://huggingface.co/docs/transformers/model_doc/t5)
122
+
123
+ # Usage
124
+
125
+ Find below some example scripts on how to use the model in `transformers`:
126
+
127
+ ## Using the Pytorch model
128
+
129
+ ### Running the model on a CPU
130
+
131
+ <details>
132
+ <summary> Click to expand </summary>
133
+
134
+ ```python
135
+
136
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
137
+
138
+ tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-base")
139
+ model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-base")
140
+
141
+ input_text = "translate English to German: How old are you?"
142
+ input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids
143
+
144
+ outputs = model.generate(input_ids)
145
+ print(tokenizer.decode(outputs[0]))
146
+ ```
147
+
148
+ </details>
149
+
150
+ ### Running the model on a GPU
151
+
152
+ <details>
153
+ <summary> Click to expand </summary>
154
+
155
+ ```python
156
+ # pip install accelerate
157
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
158
+
159
+ tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-base")
160
+ model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-base", device_map="auto")
161
+
162
+ input_text = "translate English to German: How old are you?"
163
+ input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids.to("cuda")
164
+
165
+ outputs = model.generate(input_ids)
166
+ print(tokenizer.decode(outputs[0]))
167
+ ```
168
+
169
+ </details>
170
+
171
+ ### Running the model on a GPU using different precisions
172
+
173
+ #### FP16
174
+
175
+ <details>
176
+ <summary> Click to expand </summary>
177
+
178
+ ```python
179
+ # pip install accelerate
180
+ import torch
181
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
182
+
183
+ tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-base")
184
+ model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-base", device_map="auto", torch_dtype=torch.float16)
185
+
186
+ input_text = "translate English to German: How old are you?"
187
+ input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids.to("cuda")
188
+
189
+ outputs = model.generate(input_ids)
190
+ print(tokenizer.decode(outputs[0]))
191
+ ```
192
+
193
+ </details>
194
+
195
+ #### INT8
196
+
197
+ <details>
198
+ <summary> Click to expand </summary>
199
+
200
+ ```python
201
+ # pip install bitsandbytes accelerate
202
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
203
+
204
+ tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-base")
205
+ model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-base", device_map="auto", load_in_8bit=True)
206
+
207
+ input_text = "translate English to German: How old are you?"
208
+ input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids.to("cuda")
209
+
210
+ outputs = model.generate(input_ids)
211
+ print(tokenizer.decode(outputs[0]))
212
+ ```
213
+
214
+ </details>
215
+
216
+ # Uses
217
+
218
+ ## Direct Use and Downstream Use
219
+
220
+ The authors write in [the original paper's model card](https://arxiv.org/pdf/2210.11416.pdf) that:
221
+
222
+ > The primary use is research on language models, including: research on zero-shot NLP tasks and in-context few-shot learning NLP tasks, such as reasoning, and question answering; advancing fairness and safety research, and understanding limitations of current large language models
223
+
224
+ See the [research paper](https://arxiv.org/pdf/2210.11416.pdf) for further details.
225
+
226
+ ## Out-of-Scope Use
227
+
228
+ More information needed.
229
+
230
+ # Bias, Risks, and Limitations
231
+
232
+ The information below in this section are copied from the model's [official model card](https://arxiv.org/pdf/2210.11416.pdf):
233
+
234
+ > Language models, including Flan-T5, can potentially be used for language generation in a harmful way, according to Rae et al. (2021). Flan-T5 should not be used directly in any application, without a prior assessment of safety and fairness concerns specific to the application.
235
+
236
+ ## Ethical considerations and risks
237
+
238
+ > Flan-T5 is fine-tuned on a large corpus of text data that was not filtered for explicit content or assessed for existing biases. As a result the model itself is potentially vulnerable to generating equivalently inappropriate content or replicating inherent biases in the underlying data.
239
+
240
+ ## Known Limitations
241
+
242
+ > Flan-T5 has not been tested in real world applications.
243
+
244
+ ## Sensitive Use:
245
+
246
+ > Flan-T5 should not be applied for any unacceptable use cases, e.g., generation of abusive speech.
247
+
248
+ # Training Details
249
+
250
+ ## Training Data
251
+
252
+ The model was trained on a mixture of tasks, that includes the tasks described in the table below (from the original paper, figure 2):
253
+
254
+ ![table.png](https://s3.amazonaws.com/moonup/production/uploads/1666363265279-62441d1d9fdefb55a0b7d12c.png)
255
+
256
+
257
+ ## Training Procedure
258
+
259
+ According to the model card from the [original paper](https://arxiv.org/pdf/2210.11416.pdf):
260
+
261
+ > These models are based on pretrained T5 (Raffel et al., 2020) and fine-tuned with instructions for better zero-shot and few-shot performance. There is one fine-tuned Flan model per T5 model size.
262
+
263
+ The model has been trained on TPU v3 or TPU v4 pods, using [`t5x`](https://github.com/google-research/t5x) codebase together with [`jax`](https://github.com/google/jax).
264
+
265
+
266
+ # Evaluation
267
+
268
+ ## Testing Data, Factors & Metrics
269
+
270
+ The authors evaluated the model on various tasks covering several languages (1836 in total). See the table below for some quantitative evaluation:
271
+ ![image.png](https://s3.amazonaws.com/moonup/production/uploads/1666361983550-62441d1d9fdefb55a0b7d12c.png)
272
+ For full details, please check the [research paper](https://arxiv.org/pdf/2210.11416.pdf).
273
+
274
+ ## Results
275
+
276
+ For full results for FLAN-T5-Base, see the [research paper](https://arxiv.org/pdf/2210.11416.pdf), Table 3.
277
+
278
+ # Environmental Impact
279
+
280
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
281
+
282
+ - **Hardware Type:** Google Cloud TPU Pods - TPU v3 or TPU v4 | Number of chips ≥ 4.
283
+ - **Hours used:** More information needed
284
+ - **Cloud Provider:** GCP
285
+ - **Compute Region:** More information needed
286
+ - **Carbon Emitted:** More information needed
287
+
288
+ # Citation
289
+
290
+ **BibTeX:**
291
+
292
+ ```bibtex
293
+ @misc{https://doi.org/10.48550/arxiv.2210.11416,
294
+ doi = {10.48550/ARXIV.2210.11416},
295
+
296
+ url = {https://arxiv.org/abs/2210.11416},
297
+
298
+ author = {Chung, Hyung Won and Hou, Le and Longpre, Shayne and Zoph, Barret and Tay, Yi and Fedus, William and Li, Eric and Wang, Xuezhi and Dehghani, Mostafa and Brahma, Siddhartha and Webson, Albert and Gu, Shixiang Shane and Dai, Zhuyun and Suzgun, Mirac and Chen, Xinyun and Chowdhery, Aakanksha and Narang, Sharan and Mishra, Gaurav and Yu, Adams and Zhao, Vincent and Huang, Yanping and Dai, Andrew and Yu, Hongkun and Petrov, Slav and Chi, Ed H. and Dean, Jeff and Devlin, Jacob and Roberts, Adam and Zhou, Denny and Le, Quoc V. and Wei, Jason},
299
+
300
+ keywords = {Machine Learning (cs.LG), Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
301
+
302
+ title = {Scaling Instruction-Finetuned Language Models},
303
+
304
+ publisher = {arXiv},
305
+
306
+ year = {2022},
307
+
308
+ copyright = {Creative Commons Attribution 4.0 International}
309
+ }
310
+ ```