Views
No views yet

| Set | Samples |
|---|---|
| Train | 2696 |
| Valid | 384 |
| Test | 784 |
para field) and options (choices field) are concatenated and passed to the encoder. The decoder receives the right answer (by querying answerKey field). More details about the dataset fields/format here| Set | Metric | Score |
|---|---|---|
| Validation | Accuracy (EM) | 83.59 |
| Test | Accuracy (EM) | 81.50 |
1from transformers import AutoModelWithLMHead, AutoTokenizer
2
3tokenizer = AutoTokenizer.from_pretrained("mrm8488/t5-base-finetuned-quartz")
4model = AutoModelWithLMHead.from_pretrained("mrm8488/t5-base-finetuned-quartz")
5
6def get_response(question, fact, opts, max_length=16):
7 input_text = 'question: %s context: %s options: %s' % (question, fact, opts)
8 features = tokenizer([input_text], return_tensors='pt')
9
10 output = model.generate(input_ids=features['input_ids'],
11 attention_mask=features['attention_mask'],
12 max_length=max_length)
13
14 return tokenizer.decode(output[0])
15
16fact = 'The sooner cancer is detected the easier it is to treat.'
17question = 'John was a doctor in a cancer ward and knew that early detection was key. The cancer being detected quickly makes the cancer treatment'
18opts = 'Easier, Harder'
19
20get_response(question, fact, opts)
21
22# output: 'Easier'Created by Manuel Romero/@mrm8488 | LinkedIn
Made with ♥ in Spain