This model is fine-tuned from
deepset/xlm-roberta-large-squad2 on a synthetic dataset of 38,696 QA pairs about Tatarstan geographical names.
1from transformers import pipeline
2
3# Load model (automatically downloads from Hub)
4qa_pipeline = pipeline(
5 "question-answering",
6 model="TatarNLPWorld/xlm-roberta-large-tatar-toponyms-qa"
7)
8
9# Example with context from dataset
10context = """
11Название (рус): Рантамак | Название (тат): Рантамак | Объект: Село |
12Расположение: на р. Мелля, в 21 км к востоку от с. Сарманово |
13Этимология: Топоним произошел от ойконима «Рангазар-Тамак» |
14Координаты: 55.205461, 52.881862
15"""
16
17questions = [
18 "Где находится Рантамак?",
19 "Что означает название Рантамак?",
20 "Какие координаты у Рантамак?",
21 "Какой тип объекта у Рантамак?"
22]
23
24for question in questions:
25 result = qa_pipeline(question=question, context=context)
26 print(f"Q: {question}")
27 print(f"A: {result['answer']}")
28 print(f"Confidence: {result['score']:.3f}\n")
1from transformers import AutoTokenizer, AutoModelForQuestionAnswering
2import torch
3
4# Load model and tokenizer
5tokenizer = AutoTokenizer.from_pretrained("TatarNLPWorld/xlm-roberta-large-tatar-toponyms-qa")
6model = AutoModelForQuestionAnswering.from_pretrained("TatarNLPWorld/xlm-roberta-large-tatar-toponyms-qa")
7
8# Move to GPU if available
9device = "cuda" if torch.cuda.is_available() else "cpu"
10model = model.to(device)
11
12# Prepare inputs
13inputs = tokenizer(question, context, return_tensors="pt", truncation=True, max_length=512).to(device)
14
15# Get predictions
16with torch.no_grad():
17 outputs = model(**inputs)
18
19# Decode answer
20start_idx = torch.argmax(outputs.start_logits)
21end_idx = torch.argmax(outputs.end_logits)
22answer = tokenizer.decode(inputs["input_ids"][0][start_idx:end_idx+1], skip_special_tokens=True)
23print(f"Answer: {answer}")
1@model{xlm_roberta_large_tatar_toponyms_qa,
2 author = {Arabov, Mullosharaf Kurbonvoich},
3 title = {XLM-RoBERTa Large for Tatar Toponyms QA},
4 year = {2026},
5 publisher = {Hugging Face},
6 journal = {Hugging Face Hub},
7 howpublished = {\url{https://huggingface.co/TatarNLPWorld/xlm-roberta-large-tatar-toponyms-qa}}
8}
1@dataset{tatarstan_toponyms_qa_2026,
2 title = {Tatarstan Toponyms QA Dataset},
3 author = {Arabov, Mullosharaf Kurbonvoich},
4 year = {2026},
5 publisher = {Hugging Face},
6 url = {https://huggingface.co/datasets/TatarNLPWorld/tatarstan-toponyms-qa}
7}