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