Edit model card

Model Details

  • Base: mt5
  • Developed by: Aldiyar Saken, Sultaniyar Quandyq, Alibek Kamiluly, Kurmash Apayev, Adai Shomanov and Aliya Nugumanova.

Model Description

This model is based on the google/mt5-large model. The model was fine-tuned on a Kazakh language version of the Stanford Question Answering Dataset (SQuAD) using 30,000 samples.

Inference


from transformers import T5Tokenizer, T5TokenizerFast
from transformers import T5ForConditionalGeneration
import sentencepiece

tokenizer = T5Tokenizer.from_pretrained("Kyrmasch/t5-kazakh-qa")
model = T5ForConditionalGeneration.from_pretrained("Kyrmasch/t5-kazakh-qa")

context = "Қазақстан Еуразия құрлығының орталығында орналасқан және аумақтың көлемі бойынша (жер шарының бетінде 2%) әлемде тоғызыншы орынға ие. Қазақстан аумағы бүкіл Батыс Еуропадан үлкен."
question = "Қазақстан жер көлемі жөнінен дүние жүзінде нешінші орында?"

encoded = tokenizer.encode_plus(context, question, max_length=128, pad_to_max_length=True, truncation=True, return_tensors="pt")
input_ids = encoded["input_ids"].to('cpu')
attention_mask = encoded["attention_mask"].to('cpu')
output = model.generate(input_ids=input_ids, attention_mask=attention_mask, max_length=128)
answer = ''.join([tokenizer.decode(ids, skip_special_tokens=True) for ids in output])
Downloads last month
158
Safetensors
Model size
756M params
Tensor type
F32
·