Views
No views yet

facebookAI/roberta-base model for question-answering tasks, trained on the SajjadAyoubi/persian_qa dataset. This model is designed to understand and generate answers to questions posed in Persian.roberta-base architecture to provide answers based on the context provided. The training process was performed with a focus on improving the model's ability to handle Persian text and answer questions effectively.transformers library:1from transformers import AutoTokenizer, AutoModelForQuestionAnswering, pipeline
2
3model = "hosseinhimself/tara-roberta-base-fa-qa"
4
5# Load the tokenizer and model
6tokenizer = AutoTokenizer.from_pretrained(model)
7model = AutoModelForQuestionAnswering.from_pretrained(model)
8
9# Create a QA pipeline
10qa_pipeline = pipeline("question-answering", model=model, tokenizer=tokenizer)
11
12# Example usage
13context = "شرکت فولاد مبارکه در سال 1371 تأسیس شد."
14
15question = "چه زمانی شرکت فولاد مبارکه تأسیس شد؟"
16
17# Modify the pipeline to return answer
18results = qa_pipeline(question=question, context=context)
19
20# Display the answer
21print(results['answer'])