psxjp5 commited on
Commit
8a94c9b
1 Parent(s): f93b91e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -5
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 = "username/model-name"
92
- model = AutoModelForCausalLM.from_pretrained(model_name)
93
  tokenizer = AutoTokenizer.from_pretrained(model_name)
94
 
95
  # Generate text
96
- input_text = "Once upon a time"
97
- input_ids = tokenizer.encode(input_text, return_tensors="pt")
98
- output = model.generate(input_ids, max_length=50)
 
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
  ```