Update README.md
Browse files
README.md
CHANGED
|
@@ -64,10 +64,22 @@ language:
|
|
| 64 |
widget:
|
| 65 |
- text: "Translate to German: My name is Arthur"
|
| 66 |
example_title: "Translation"
|
| 67 |
-
- text: "Please answer to the following question. Who is going to be the next
|
| 68 |
example_title: "Question Answering"
|
| 69 |
-
- text: "
|
| 70 |
-
example_title: "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
tags:
|
| 73 |
- text2text-generation
|
|
@@ -142,8 +154,8 @@ Find below some example scripts on how to use the model in `transformers`:
|
|
| 142 |
|
| 143 |
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
| 144 |
|
| 145 |
-
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-
|
| 146 |
-
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-
|
| 147 |
|
| 148 |
input_text = "translate English to German: How old are you?"
|
| 149 |
input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids
|
|
@@ -163,8 +175,8 @@ print(tokenizer.decode(outputs[0]))
|
|
| 163 |
# pip install accelerate
|
| 164 |
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
| 165 |
|
| 166 |
-
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-
|
| 167 |
-
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-
|
| 168 |
|
| 169 |
input_text = "translate English to German: How old are you?"
|
| 170 |
input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids.to("cuda")
|
|
@@ -187,8 +199,8 @@ print(tokenizer.decode(outputs[0]))
|
|
| 187 |
import torch
|
| 188 |
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
| 189 |
|
| 190 |
-
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-
|
| 191 |
-
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-
|
| 192 |
|
| 193 |
input_text = "translate English to German: How old are you?"
|
| 194 |
input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids.to("cuda")
|
|
@@ -208,8 +220,8 @@ print(tokenizer.decode(outputs[0]))
|
|
| 208 |
# pip install bitsandbytes accelerate
|
| 209 |
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
| 210 |
|
| 211 |
-
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-
|
| 212 |
-
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-
|
| 213 |
|
| 214 |
input_text = "translate English to German: How old are you?"
|
| 215 |
input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids.to("cuda")
|
|
@@ -280,7 +292,7 @@ For full details, please check the [research paper](https://arxiv.org/pdf/2210.1
|
|
| 280 |
|
| 281 |
## Results
|
| 282 |
|
| 283 |
-
For full results for FLAN-T5-
|
| 284 |
|
| 285 |
# Environmental Impact
|
| 286 |
|
|
|
|
| 64 |
widget:
|
| 65 |
- text: "Translate to German: My name is Arthur"
|
| 66 |
example_title: "Translation"
|
| 67 |
+
- text: "Please answer to the following question. Who is going to be the next Ballon d'or?"
|
| 68 |
example_title: "Question Answering"
|
| 69 |
+
- text: "Q: Can Geoffrey Hinton have a conversation with George Washington? Give the rationale before answering."
|
| 70 |
+
example_title: "Logical reasoning"
|
| 71 |
+
- text: "Please answer the following question. What is the boiling point of Nitrogen?"
|
| 72 |
+
example_title: "Scientific knowledge"
|
| 73 |
+
- text: "Answer the following yes/no question. Can you write a whole Haiku in a single tweet?"
|
| 74 |
+
example_title: "Yes/no question"
|
| 75 |
+
- text: "Answer the following yes/no question by reasoning step-by-step. Can you write a whole Haiku in a single tweet?"
|
| 76 |
+
example_title: "Reasoning task"
|
| 77 |
+
- text: "Q: ( False or not False or False ) is? A: Let's think step by step"
|
| 78 |
+
example_title: "Boolean Expressions"
|
| 79 |
+
- text: "The square root of x is the cube root of y. What is y to the power of 2, if x = 4?"
|
| 80 |
+
example_title: "Math reasoning"
|
| 81 |
+
- text: "Premise: At my age you will probably have learnt one lesson. Hypothesis: It's not certain how many lessons you'll learn by your thirties. Does the premise entail the hypothesis?"
|
| 82 |
+
example_title: "Premise and hypothesis"
|
| 83 |
|
| 84 |
tags:
|
| 85 |
- text2text-generation
|
|
|
|
| 154 |
|
| 155 |
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
| 156 |
|
| 157 |
+
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
|
| 158 |
+
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl")
|
| 159 |
|
| 160 |
input_text = "translate English to German: How old are you?"
|
| 161 |
input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids
|
|
|
|
| 175 |
# pip install accelerate
|
| 176 |
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
| 177 |
|
| 178 |
+
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
|
| 179 |
+
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl", device_map="auto")
|
| 180 |
|
| 181 |
input_text = "translate English to German: How old are you?"
|
| 182 |
input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids.to("cuda")
|
|
|
|
| 199 |
import torch
|
| 200 |
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
| 201 |
|
| 202 |
+
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
|
| 203 |
+
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl", device_map="auto", torch_dtype=torch.float16)
|
| 204 |
|
| 205 |
input_text = "translate English to German: How old are you?"
|
| 206 |
input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids.to("cuda")
|
|
|
|
| 220 |
# pip install bitsandbytes accelerate
|
| 221 |
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
| 222 |
|
| 223 |
+
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
|
| 224 |
+
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl", device_map="auto", load_in_8bit=True)
|
| 225 |
|
| 226 |
input_text = "translate English to German: How old are you?"
|
| 227 |
input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids.to("cuda")
|
|
|
|
| 292 |
|
| 293 |
## Results
|
| 294 |
|
| 295 |
+
For full results for FLAN-T5-XXL, see the [research paper](https://arxiv.org/pdf/2210.11416.pdf), Table 3.
|
| 296 |
|
| 297 |
# Environmental Impact
|
| 298 |
|