Back to all models
translation mask_token:
Query this model
πŸ”₯ This model is currently loaded and running on the Inference API. ⚠️ This model could not be loaded by the inference API. ⚠️ This model can be loaded on the Inference API on-demand.
JSON Output
API endpoint
								$
								curl -X POST \
-H "Authorization: Bearer YOUR_ORG_OR_USER_API_TOKEN" \
-H "Content-Type: application/json" \
-d '"json encoded string"' \
https://api-inference.huggingface.co/models/valhalla/t5-base-squad
Share Copied link to clipboard

Monthly model downloads

valhalla/t5-base-squad valhalla/t5-base-squad
188 downloads
last 30 days

pytorch

tf

Contributed by

valhalla Suraj Patil
11 models

How to use this model directly from the πŸ€—/transformers library:

			
Copy to clipboard
from transformers import AutoTokenizer, AutoModelWithLMHead tokenizer = AutoTokenizer.from_pretrained("valhalla/t5-base-squad") model = AutoModelWithLMHead.from_pretrained("valhalla/t5-base-squad")

T5 for question-answering

This is T5-base model fine-tuned on SQuAD1.1 for QA using text-to-text approach

Model training

This model was trained on colab TPU with 35GB RAM for 4 epochs

Results:

Metric #Value
Exact Match 81.5610
F1 89.9601

Model in Action πŸš€

from transformers import AutoModelWithLMHead, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("valhalla/t5-base-squad")
model = AutoModelWithLMHead.from_pretrained("valhalla/t5-base-squad")

def get_answer(question, context):
  input_text = "question: %s  context: %s </s>" % (question, context)
  features = tokenizer([input_text], return_tensors='pt')

  out = model.generate(input_ids=features['input_ids'], 
               attention_mask=features['attention_mask'])

  return tokenizer.decode(out[0])

context = "In Norse mythology, Valhalla is a majestic, enormous hall located in Asgard, ruled over by the god Odin."
question = "What is Valhalla ?"

get_answer(question, context)
# output: 'a majestic, enormous hall located in Asgard, ruled over by the god Odin'

Play with this model Open In Colab

Created by Suraj Patil Github icon Twitter icon