Update README.md
Browse files
README.md
CHANGED
@@ -88,14 +88,15 @@ More information needed
|
|
88 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
89 |
|
90 |
# Load model and tokenizer
|
91 |
-
model_name = "
|
92 |
-
model =
|
93 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
94 |
|
95 |
# Generate text
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
99 |
|
100 |
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
101 |
```
|
|
|
88 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
89 |
|
90 |
# Load model and tokenizer
|
91 |
+
model_name = "psxjp5/mt5-small"
|
92 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
93 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
94 |
|
95 |
# Generate text
|
96 |
+
context = "Once upon a time"
|
97 |
+
question = "What is time"
|
98 |
+
input_ids = tokenizer(context, question, return_tensors="pt").input_ids
|
99 |
+
outputs = model.generate(input_ids, max_new_tokens=150)
|
100 |
|
101 |
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
102 |
```
|