Instructions to use google/flan-t5-xl with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/flan-t5-xl with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("google/flan-t5-xl") model = AutoModelForSeq2SeqLM.from_pretrained("google/flan-t5-xl") - Notebooks
- Google Colab
- Kaggle
Update README.md
#2
by ybelkada - opened
README.md
CHANGED
|
@@ -158,7 +158,7 @@ tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xl")
|
|
| 158 |
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xl")
|
| 159 |
|
| 160 |
input_text = "translate English to German: How old are you?"
|
| 161 |
-
input_ids = tokenizer
|
| 162 |
|
| 163 |
outputs = model.generate(input_ids)
|
| 164 |
print(tokenizer.decode(outputs[0]))
|
|
@@ -179,7 +179,7 @@ tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xl")
|
|
| 179 |
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xl", device_map="auto")
|
| 180 |
|
| 181 |
input_text = "translate English to German: How old are you?"
|
| 182 |
-
input_ids = tokenizer
|
| 183 |
|
| 184 |
outputs = model.generate(input_ids)
|
| 185 |
print(tokenizer.decode(outputs[0]))
|
|
@@ -203,7 +203,7 @@ tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xl")
|
|
| 203 |
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xl", device_map="auto", torch_dtype=torch.float16)
|
| 204 |
|
| 205 |
input_text = "translate English to German: How old are you?"
|
| 206 |
-
input_ids = tokenizer
|
| 207 |
|
| 208 |
outputs = model.generate(input_ids)
|
| 209 |
print(tokenizer.decode(outputs[0]))
|
|
@@ -224,7 +224,7 @@ tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xl")
|
|
| 224 |
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xl", device_map="auto", load_in_8bit=True)
|
| 225 |
|
| 226 |
input_text = "translate English to German: How old are you?"
|
| 227 |
-
input_ids = tokenizer
|
| 228 |
|
| 229 |
outputs = model.generate(input_ids)
|
| 230 |
print(tokenizer.decode(outputs[0]))
|
|
|
|
| 158 |
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xl")
|
| 159 |
|
| 160 |
input_text = "translate English to German: How old are you?"
|
| 161 |
+
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
|
| 162 |
|
| 163 |
outputs = model.generate(input_ids)
|
| 164 |
print(tokenizer.decode(outputs[0]))
|
|
|
|
| 179 |
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xl", device_map="auto")
|
| 180 |
|
| 181 |
input_text = "translate English to German: How old are you?"
|
| 182 |
+
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
|
| 183 |
|
| 184 |
outputs = model.generate(input_ids)
|
| 185 |
print(tokenizer.decode(outputs[0]))
|
|
|
|
| 203 |
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xl", device_map="auto", torch_dtype=torch.float16)
|
| 204 |
|
| 205 |
input_text = "translate English to German: How old are you?"
|
| 206 |
+
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
|
| 207 |
|
| 208 |
outputs = model.generate(input_ids)
|
| 209 |
print(tokenizer.decode(outputs[0]))
|
|
|
|
| 224 |
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xl", device_map="auto", load_in_8bit=True)
|
| 225 |
|
| 226 |
input_text = "translate English to German: How old are you?"
|
| 227 |
+
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
|
| 228 |
|
| 229 |
outputs = model.generate(input_ids)
|
| 230 |
print(tokenizer.decode(outputs[0]))
|