danyaljj commited on
Commit
6be305e
1 Parent(s): a5253bc

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +23 -0
README.md ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SQuAD 1.1 question-answering based on T5-small.
2
+ Example use:
3
+
4
+ ```python
5
+ from transformers import T5Config, T5ForConditionalGeneration, T5Tokenizer
6
+
7
+ model_name = "allenai/t5-small-next-word-generator-qoogle"
8
+ tokenizer = T5Tokenizer.from_pretrained(model_name)
9
+ model = T5ForConditionalGeneration.from_pretrained(model_name)
10
+
11
+ def run_model(input_string, **generator_args):
12
+ input_ids = tokenizer.encode(input_string, return_tensors="pt")
13
+ res = model.generate(input_ids, **generator_args)
14
+ output = tokenizer.batch_decode(res, skip_special_tokens=True)
15
+ print(output)
16
+ return output
17
+
18
+ run_model("Who is the winner of 2009 olympics? \n Jack and Jill participated, but James won the games.")```
19
+ which should result in the following:
20
+ ```
21
+ ['James']
22
+ ```
23
+