philschmid HF staff commited on
Commit
0b5bbb6
1 Parent(s): 6890929

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +231 -1
README.md CHANGED
@@ -1,3 +1,233 @@
1
  ---
2
- duplicated_from: Artifact-AI/flan-t5-xxl-sharded-fp16
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: apache-2.0
3
  ---
4
+
5
+ # Model Card for FLAN-T5 XXL
6
+
7
+ ![model image](https://s3.amazonaws.com/moonup/production/uploads/1666363435475-62441d1d9fdefb55a0b7d12c.png)
8
+
9
+ # Table of Contents
10
+
11
+ 0. [TL;DR](#TL;DR)
12
+ 1. [Model Details](#model-details)
13
+ 2. [Usage](#usage)
14
+ 3. [Uses](#uses)
15
+ 4. [Bias, Risks, and Limitations](#bias-risks-and-limitations)
16
+ 5. [Training Details](#training-details)
17
+ 6. [Evaluation](#evaluation)
18
+ 7. [Environmental Impact](#environmental-impact)
19
+ 8. [Citation](#citation)
20
+
21
+ # TL;DR
22
+
23
+ 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.
24
+ As mentioned in the first few lines of the abstract :
25
+ > 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.
26
+
27
+ **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).
28
+
29
+ # Model Details
30
+
31
+ ## Model Description
32
+
33
+
34
+ - **Model type:** Language model
35
+ - **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
36
+ - **License:** Apache 2.0
37
+ - **Related Models:** [All FLAN-T5 Checkpoints](https://huggingface.co/models?search=flan-t5)
38
+ - **Original Checkpoints:** [All Original FLAN-T5 Checkpoints](https://github.com/google-research/t5x/blob/main/docs/models.md#flan-t5-checkpoints)
39
+ - **Resources for more information:**
40
+ - [Research paper](https://arxiv.org/pdf/2210.11416.pdf)
41
+ - [GitHub Repo](https://github.com/google-research/t5x)
42
+ - [Hugging Face FLAN-T5 Docs (Similar to T5) ](https://huggingface.co/docs/transformers/model_doc/t5)
43
+
44
+ # Usage
45
+
46
+ Find below some example scripts on how to use the model in `transformers`:
47
+
48
+ ## Using the Pytorch model
49
+
50
+ ### Running the model on a CPU
51
+
52
+ <details>
53
+ <summary> Click to expand </summary>
54
+
55
+ ```python
56
+
57
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
58
+
59
+ tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
60
+ model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl")
61
+
62
+ input_text = "translate English to German: How old are you?"
63
+ input_ids = tokenizer(input_text, return_tensors="pt").input_ids
64
+
65
+ outputs = model.generate(input_ids)
66
+ print(tokenizer.decode(outputs[0]))
67
+ ```
68
+
69
+ </details>
70
+
71
+ ### Running the model on a GPU
72
+
73
+ <details>
74
+ <summary> Click to expand </summary>
75
+
76
+ ```python
77
+ # pip install accelerate
78
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
79
+
80
+ tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
81
+ model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl", device_map="auto")
82
+
83
+ input_text = "translate English to German: How old are you?"
84
+ input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
85
+
86
+ outputs = model.generate(input_ids)
87
+ print(tokenizer.decode(outputs[0]))
88
+ ```
89
+
90
+ </details>
91
+
92
+ ### Running the model on a GPU using different precisions
93
+
94
+ #### FP16
95
+
96
+ <details>
97
+ <summary> Click to expand </summary>
98
+
99
+ ```python
100
+ # pip install accelerate
101
+ import torch
102
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
103
+
104
+ tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
105
+ model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl", device_map="auto", torch_dtype=torch.float16)
106
+
107
+ input_text = "translate English to German: How old are you?"
108
+ input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
109
+
110
+ outputs = model.generate(input_ids)
111
+ print(tokenizer.decode(outputs[0]))
112
+ ```
113
+
114
+ </details>
115
+
116
+ #### INT8
117
+
118
+ <details>
119
+ <summary> Click to expand </summary>
120
+
121
+ ```python
122
+ # pip install bitsandbytes accelerate
123
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
124
+
125
+ tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
126
+ model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl", device_map="auto", load_in_8bit=True)
127
+
128
+ input_text = "translate English to German: How old are you?"
129
+ input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
130
+
131
+ outputs = model.generate(input_ids)
132
+ print(tokenizer.decode(outputs[0]))
133
+ ```
134
+
135
+ </details>
136
+
137
+ # Uses
138
+
139
+ ## Direct Use and Downstream Use
140
+
141
+ The authors write in [the original paper's model card](https://arxiv.org/pdf/2210.11416.pdf) that:
142
+
143
+ > 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
144
+
145
+ See the [research paper](https://arxiv.org/pdf/2210.11416.pdf) for further details.
146
+
147
+ ## Out-of-Scope Use
148
+
149
+ More information needed.
150
+
151
+ # Bias, Risks, and Limitations
152
+
153
+ The information below in this section are copied from the model's [official model card](https://arxiv.org/pdf/2210.11416.pdf):
154
+
155
+ > 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.
156
+
157
+ ## Ethical considerations and risks
158
+
159
+ > 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.
160
+
161
+ ## Known Limitations
162
+
163
+ > Flan-T5 has not been tested in real world applications.
164
+
165
+ ## Sensitive Use:
166
+
167
+ > Flan-T5 should not be applied for any unacceptable use cases, e.g., generation of abusive speech.
168
+
169
+ # Training Details
170
+
171
+ ## Training Data
172
+
173
+ The model was trained on a mixture of tasks, that includes the tasks described in the table below (from the original paper, figure 2):
174
+
175
+ ![table.png](https://s3.amazonaws.com/moonup/production/uploads/1666363265279-62441d1d9fdefb55a0b7d12c.png)
176
+
177
+
178
+ ## Training Procedure
179
+
180
+ According to the model card from the [original paper](https://arxiv.org/pdf/2210.11416.pdf):
181
+
182
+ > 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.
183
+
184
+ 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).
185
+
186
+
187
+ # Evaluation
188
+
189
+ ## Testing Data, Factors & Metrics
190
+
191
+ The authors evaluated the model on various tasks covering several languages (1836 in total). See the table below for some quantitative evaluation:
192
+ ![image.png](https://s3.amazonaws.com/moonup/production/uploads/1668072995230-62441d1d9fdefb55a0b7d12c.png)
193
+ For full details, please check the [research paper](https://arxiv.org/pdf/2210.11416.pdf).
194
+
195
+ ## Results
196
+
197
+ For full results for FLAN-T5-XXL, see the [research paper](https://arxiv.org/pdf/2210.11416.pdf), Table 3.
198
+
199
+ # Environmental Impact
200
+
201
+ 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).
202
+
203
+ - **Hardware Type:** Google Cloud TPU Pods - TPU v3 or TPU v4 | Number of chips ≥ 4.
204
+ - **Hours used:** More information needed
205
+ - **Cloud Provider:** GCP
206
+ - **Compute Region:** More information needed
207
+ - **Carbon Emitted:** More information needed
208
+
209
+ # Citation
210
+
211
+ **BibTeX:**
212
+
213
+ ```bibtex
214
+ @misc{https://doi.org/10.48550/arxiv.2210.11416,
215
+ doi = {10.48550/ARXIV.2210.11416},
216
+
217
+ url = {https://arxiv.org/abs/2210.11416},
218
+
219
+ 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},
220
+
221
+ keywords = {Machine Learning (cs.LG), Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
222
+
223
+ title = {Scaling Instruction-Finetuned Language Models},
224
+
225
+ publisher = {arXiv},
226
+
227
+ year = {2022},
228
+
229
+ copyright = {Creative Commons Attribution 4.0 International}
230
+ }
231
+ ```
232
+
233
+