XLM-RoBERTa grande para QA (PersianQA - 🇮🇷)

m3hrdadfi
Pregunta y respuesta

Este modelo es una versión afinada de xlm-roberta-large en el conjunto de datos PersianQA. Fue creado por Mehrdad Farahani. Utiliza la arquitectura de Transformers y es compatible con PyTorch y TensorFlow. El modelo está diseñado para tareas de pregunta-respuesta y ha sido evaluado con métricas específicas como Eval F1 y Eval Exact.

Como usar

from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline

model_name_or_path = "m3hrdadfi/xlmr-large-qa-fa"
nlp = pipeline('question-answering', model=model_name_or_path, tokenizer=model_name_or_path)

context = """
شب یَلدا یا شب چلّه یکی از کهن‌ترین جشن‌های ایرانی است.
در این جشن، طی شدن بلندترین شب سال و به دنبال آن بلندتر شدن طول روزها
در نیم‌کرهٔ شمالی، که مصادف با انقلاب زمستانی است، گرامی داشته می‌شود.
نام دیگر این شب «چِلّه» است، زیرا برگزاری این جشن، یک آیین ایرانی‌است.
"""
# Translation [EN]
# context = [
# Yalda night or Cheleh night is one of the oldest Iranian celebrations.
# The festival celebrates the longest night of the year, followed by longer days in the Northern Hemisphere,
# which coincides with the Winter Revolution.
# Another name for this night is "Chelleh", because holding this celebration is an Iranian ritual.
# ]

questions = [
"نام دیگر شب یلدا؟",
"کهن ترین جشن ایرانی‌ها چه است؟",
"شب یلدا مصادف با چه پدیده‌ای است؟"
]
# Translation [EN]
# questions = [
# Another name for Yalda night?
# What is the ancient tradition of Iranian celebration?
# What phenomenon does Yalda night coincide with?
# ]

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
نام دیگر شب یلدا؟ «چِلّه»
کهن ترین جشن ایرانی‌ها چه است؟ شب یَلدا یا شب چلّه
شب یلدا مصادف با چه پدیده‌ای است؟ انقلاب زمستانی

# Translation [EN]
# Another name for Yalda night? Cheleh night
# What is the ancient tradition of Iranian celebration? Yalda night or Chele night
# What phenomenon does Yalda night coincide with? Winter revolution

Funcionalidades

version afinada de xlm-roberta-large
conjunto de datos PersianQA
compatible con PyTorch y TensorFlow
optimizado para tareas de pregunta-respuesta
soporta multilingüe

Casos de uso

Respuestas a preguntas específicas del contexto proporcionado
Soporte multilingüe
Aplicaciones en dominios que requieren comprensión lectora avanzada como historia y eventos culturales
Entrenamiento y afinamiento en conjuntos de datos específicos