Downloads · 30 days
17
2% of all-time downloads
m3hrdadfi/xlmr-large-qa-sv
xlmr-large-qa-sv is a question answering model from m3hrdadfi. Use it when the input is a question plus a passage. It is set up for transformers.
This model is a fine-tuned version of xlm-roberta-large on the SwedishQA dataset.
Downloads · 30 days
17
2% of all-time downloads
All-time downloads
1K
Public
Repo size
6.7 GB
Likes
2
Public
Click a slice to open those files.
.h52.2 GB · 50%
From the Hugging Face model README
This model is a fine-tuned version of xlm-roberta-large on the SwedishQA dataset.
The following hyperparameters were used during training:
Evaluation results on the eval set with the official eval script.
"exact": 78.79554655870446,
"f1": 87.97339064752278,
"total": 5928
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
model_name_or_path = "m3hrdadfi/xlmr-large-qa-sv"
nlp = pipeline('question-answering', model=model_name_or_path, tokenizer=model_name_or_path)
context = """
Sveriges nationaldag och svenska flaggans dag firas den 6 juni
varje år och är en helgdag i Sverige.
Tidigare firades 6 juni enbart som "svenska flaggans dag" och det
var först 1983 som dagen även fick status som nationaldag.
"""
questions = [
"Vilket datum är den svenska nationaldagen?",
"Vad innebär helgdag i Sverige?",
"Vilket år tillkom Sveriges nationaldag?"
]
kwargs = {}
for question in questions:
r = nlp(question=question, context=context, **kwargs)
answer = " ".join([token.strip() for token in r["answer"].strip().split() if token.strip()])
print(f"{question} {answer}")
Output
Vilket datum är den svenska nationaldagen? 6 juni
Vad innebär helgdag i Sverige? svenska flaggans dag
Vilket år tillkom Sveriges nationaldag? 1983