ArthurZ HF staff commited on
Commit
7722084
1 Parent(s): 2314e6a

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
+
99
+ # TL;DR
100
+
101
+ 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.
102
+ As mentioned in the first few lines of the abstract :
103
+ > 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.
104
+
105
+ **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).
106
+
107
+ # Model Details
108
+
109
+ ## Model Description
110
+
111
+
112
+ - **Model type:** Language model
113
+ - **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
114
+ - **License:** Apache 2.0
115
+ - **Related Models:** [All FLAN-T5 Checkpoints](https://huggingface.co/models?search=flan-t5)
116
+ - **Original Checkpoints:** [All Original FLAN-T5 Checkpoints](https://github.com/google-research/t5x/blob/main/docs/models.md#flan-t5-checkpoints)
117
+ - **Resources for more information:**
118
+ - [Research paper](https://arxiv.org/pdf/2210.11416.pdf)
119
+ - [GitHub Repo](https://github.com/google-research/t5x)
120
+ - [Hugging Face FLAN-T5 Docs (Similar to T5) ](https://huggingface.co/docs/transformers/model_doc/t5)
121
+
122
+ # Usage
123
+
124
+ Find below some example scripts on how to use the model in `transformers`:
125
+
126
+ ## Using the Pytorch model
127
+
128
+ ### Running the model on a CPU
129
+
130
+ <details>
131
+ <summary> Click to expand </summary>
132
+
133
+ ```python
134
+
135
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
136
+
137
+ tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-large")
138
+ model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-large")
139
+
140
+ input_text = "translate English to German: How old are you?"
141
+ input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids
142
+
143
+ outputs = model.generate(input_ids)
144
+ print(tokenizer.decode(outputs[0]))
145
+ ```
146
+
147
+ </details>
148
+
149
+ ### Running the model on a GPU
150
+
151
+ <details>
152
+ <summary> Click to expand </summary>
153
+
154
+ ```python
155
+ # pip install accelerate
156
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
157
+
158
+ tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-large")
159
+ model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-large", device_map="auto")
160
+
161
+ input_text = "translate English to German: How old are you?"
162
+ input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids.to("cuda")
163
+
164
+ outputs = model.generate(input_ids)
165
+ print(tokenizer.decode(outputs[0]))
166
+ ```
167
+
168
+ </details>
169
+
170
+ ### Running the model on a GPU using different precisions
171
+
172
+ #### FP16
173
+
174
+ <details>
175
+ <summary> Click to expand </summary>
176
+
177
+ ```python
178
+ # pip install accelerate
179
+ import torch
180
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
181
+
182
+ tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-large")
183
+ model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-large", device_map="auto", torch_dtype=torch.float16)
184
+
185
+ input_text = "translate English to German: How old are you?"
186
+ input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids.to("cuda")
187
+
188
+ outputs = model.generate(input_ids)
189
+ print(tokenizer.decode(outputs[0]))
190
+ ```
191
+
192
+ </details>
193
+
194
+ #### INT8
195
+
196
+ <details>
197
+ <summary> Click to expand </summary>
198
+
199
+ ```python
200
+ # pip install bitsandbytes accelerate
201
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
202
+
203
+ tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-large")
204
+ model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-large", device_map="auto", load_in_8bit=True)
205
+
206
+ input_text = "translate English to German: How old are you?"
207
+ input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids.to("cuda")
208
+
209
+ outputs = model.generate(input_ids)
210
+ print(tokenizer.decode(outputs[0]))
211
+ ```
212
+
213
+ </details>
214
+
215
+ # Uses
216
+
217
+ ## Direct Use and Downstream Use
218
+
219
+ The authors write in [the original paper's model card](https://arxiv.org/pdf/2210.11416.pdf) that:
220
+
221
+ > 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
222
+
223
+ See the [research paper](https://arxiv.org/pdf/2210.11416.pdf) for further details.
224
+
225
+ ## Out-of-Scope Use
226
+
227
+ More information needed.
228
+
229
+ # Bias, Risks, and Limitations
230
+
231
+ The information below in this section are copied from the model's [official model card](https://arxiv.org/pdf/2210.11416.pdf):
232
+
233
+ > 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.
234
+
235
+ ## Ethical considerations and risks
236
+
237
+ > 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.
238
+
239
+ ## Known Limitations
240
+
241
+ > Flan-T5 has not been tested in real world applications.
242
+
243
+ ## Sensitive Use:
244
+
245
+ > Flan-T5 should not be applied for any unacceptable use cases, e.g., generation of abusive speech.
246
+
247
+ # Training Details
248
+
249
+ ## Training Data
250
+
251
+ The model was trained on a mixture of tasks, that includes the tasks described in the table below (from the original paper, figure 2):
252
+
253
+ ![table.png](https://s3.amazonaws.com/moonup/production/uploads/1666363265279-62441d1d9fdefb55a0b7d12c.png)
254
+
255
+
256
+ ## Training Procedure
257
+
258
+ According to the model card from the [original paper](https://arxiv.org/pdf/2210.11416.pdf):
259
+
260
+ > 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.
261
+
262
+ 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).
263
+
264
+
265
+ # Evaluation
266
+
267
+ ## Testing Data, Factors & Metrics
268
+
269
+ The authors evaluated the model on various tasks covering several languages (1836 in total). See the table below for some quantitative evaluation:
270
+ ![image.png](https://s3.amazonaws.com/moonup/production/uploads/1666361983550-62441d1d9fdefb55a0b7d12c.png)
271
+ For full details, please check the [research paper](https://arxiv.org/pdf/2210.11416.pdf).
272
+
273
+ ## Results
274
+
275
+ For full results for FLAN-T5-Large, see the [research paper](https://arxiv.org/pdf/2210.11416.pdf), Table 3.
276
+
277
+ # Environmental Impact
278
+
279
+ 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).
280
+
281
+ - **Hardware Type:** Google Cloud TPU Pods - TPU v3 or TPU v4 | Number of chips ≥ 4.
282
+ - **Hours used:** More information needed
283
+ - **Cloud Provider:** GCP
284
+ - **Compute Region:** More information needed
285
+ - **Carbon Emitted:** More information needed
286
+
287
+ # Citation
288
+
289
+ **BibTeX:**
290
+
291
+ ```bibtex
292
+ @misc{https://doi.org/10.48550/arxiv.2210.11416,
293
+ doi = {10.48550/ARXIV.2210.11416},
294
+
295
+ url = {https://arxiv.org/abs/2210.11416},
296
+
297
+ 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},
298
+
299
+ keywords = {Machine Learning (cs.LG), Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
300
+
301
+ title = {Scaling Instruction-Finetuned Language Models},
302
+
303
+ publisher = {arXiv},
304
+
305
+ year = {2022},
306
+
307
+ copyright = {Creative Commons Attribution 4.0 International}
308
+ }
309
+ ```
310
+