julien-c HF staff commited on
Commit
d19773e
1 Parent(s): 75a31ef

Migrate model card from transformers-repo

Browse files

Read announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/valhalla/t5-base-squad/README.md

Files changed (1) hide show
  1. README.md +38 -0
README.md ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # T5 for question-answering
2
+ This is T5-base model fine-tuned on SQuAD1.1 for QA using text-to-text approach
3
+
4
+ ## Model training
5
+ This model was trained on colab TPU with 35GB RAM for 4 epochs
6
+
7
+ ## Results:
8
+ | Metric | #Value |
9
+ |-------------|---------|
10
+ | Exact Match | 81.5610 |
11
+ | F1 | 89.9601 |
12
+
13
+ ## Model in Action 🚀
14
+ ```
15
+ from transformers import AutoModelWithLMHead, AutoTokenizer
16
+
17
+ tokenizer = AutoTokenizer.from_pretrained("valhalla/t5-base-squad")
18
+ model = AutoModelWithLMHead.from_pretrained("valhalla/t5-base-squad")
19
+
20
+ def get_answer(question, context):
21
+ input_text = "question: %s context: %s </s>" % (question, context)
22
+ features = tokenizer([input_text], return_tensors='pt')
23
+
24
+ out = model.generate(input_ids=features['input_ids'],
25
+ attention_mask=features['attention_mask'])
26
+
27
+ return tokenizer.decode(out[0])
28
+
29
+ context = "In Norse mythology, Valhalla is a majestic, enormous hall located in Asgard, ruled over by the god Odin."
30
+ question = "What is Valhalla ?"
31
+
32
+ get_answer(question, context)
33
+ # output: 'a majestic, enormous hall located in Asgard, ruled over by the god Odin'
34
+ ```
35
+ Play with this model [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1a5xpJiUjZybfU9Mi-aDkOp116PZ9-wni?usp=sharing)
36
+
37
+ > Created by Suraj Patil [![Github icon](https://cdn0.iconfinder.com/data/icons/octicons/1024/mark-github-32.png)](https://github.com/patil-suraj/)
38
+ [![Twitter icon](https://cdn0.iconfinder.com/data/icons/shift-logotypes/32/Twitter-32.png)](https://twitter.com/psuraj28)