Edit model card

Spanish T5 (small) fine-tuned on SQAC for Spanish QA 📖❓

spanish-T5-small fine-tuned on SQAC for Q&A downstream task.

Details of Spanish T5 (small)

T5 (small) like arch trained from scatch on large_spanish_corpus for HuggingFace/Flax/Jax Week.

Details of the dataset 📚

This dataset contains 6,247 contexts and 18,817 questions with their answers, 1 to 5 for each fragment. The sources of the contexts are:

Results on test dataset 📝

Metric # Value
BLEU 41.94

Model in Action 🚀

from transformers import T5ForConditionalGeneration, AutoTokenizer
import torch
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
ckpt = 'mrm8488/spanish-t5-small-sqac-for-qa'
tokenizer = AutoTokenizer.from_pretrained(ckpt)
model = T5ForConditionalGeneration.from_pretrained(ckpt).to(device)



def get_answer(question, context):
  input_text = 'question: %s  context: %s' % (question, context)
  features = tokenizer([input_text ], padding='max_length', truncation=True, max_length=512, return_tensors='pt')
  output = model.generate(input_ids=features['input_ids'].to(device), 
               attention_mask=features['attention_mask'].to(device))

  return tokenizer.decode(output[0], skip_special_tokens=True)
  
context = '''
La ex codirectora del grupo de investigación de IA ética de Google, Margaret Mitchell, 
quien fue despedida en febrero después de una controversia sobre un artículo crítico del que fue coautora, 
se unirá a HuggingFace para ayudar a que los algoritmos de IA sean más justos.
'''

question = '¿Qué hará Margaret Mitchell en HuggingFace?'

print(get_answer(context, question))

# ayudar a que los algoritmos de ia sean más justos
  

Created by Manuel Romero/@mrm8488 with the support of Narrativa

Made with in Spain

Downloads last month
129
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Space using mrm8488/spanish-t5-small-sqac-for-qa 1