Downloads · 30 days
15
3% of all-time downloads
LocalDoc/mbart_large_qa_azerbaijan
mbart_large_qa_azerbaijan is a question answering model from LocalDoc. Use it when the input is a question plus a passage. It is set up for transformers. The card lists the license as cc-by-nc-4.0.
This repository contains a fine-tuned mBART Large model for question answering in Azerbaijani. The model was trained on a custom dataset and can be used to answer questions based on a given context.
Downloads · 30 days
15
3% of all-time downloads
All-time downloads
580
Public
Parameters
611M
2.4 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.4 GB · 100%
From the Hugging Face model README
This repository contains a fine-tuned mBART Large model for question answering in Azerbaijani. The model was trained on a custom dataset and can be used to answer questions based on a given context.
Base Model: facebook/mbart-large-50
Language: Azerbaijani (az_AZ)
The model was trained for 3 epochs with the following training and validation loss:
| Epoch | Training Loss | Validation Loss |
|---|---|---|
| 1 | 0.015100 | 0.014827 |
| 2 | 0.009800 | 0.013616 |
| 3 | 0.004100 | 0.015270 |
To use this model, you need to install the transformers library from Hugging Face. You can then load the model and tokenizer and use them to answer questions based on a given context.
pip install transformers
from transformers import MBartForConditionalGeneration, MBart50Tokenizer
# Load the model and tokenizer
model_name = "LocalDoc/mbart_large_qa_azerbaijan"
tokenizer = MBart50Tokenizer.from_pretrained(model_name, src_lang="en_XX", tgt_lang="az_AZ")
model = MBartForConditionalGeneration.from_pretrained(model_name)
def answer_question(context, question):
# Prepare input text
input_text = f"context: {context} question: {question}"
inputs = tokenizer(input_text, return_tensors="pt", max_length=512, truncation=True, padding="max_length")
# Generate answer
outputs = model.generate(
input_ids=inputs["input_ids"],
attention_mask=inputs["attention_mask"],
max_length=128,
num_beams=5,
early_stopping=True
)
# Decode the answer
answer = tokenizer.decode(outputs[0], skip_special_tokens=True)
return answer
# Example usage
context = """Ey iman gətirənlər! Səbir edərək və namaz qılaraq Allahdan kömək istəyin! Şübhəsiz ki, Allah səbir edənlərlədir.
Ey iman gətirənlər, əgər yalnız Allaha ibadət edirsinizsə, sizə verdiyimiz ruzilərin təmiz olanlarından yeyin və Ona şükür edin!
Ey iman gətirənlər! Oruc tutmaq sizdən əvvəlkilərə fərz buyurulduğu kimi sizə də fərz buyuruldu ki, bəlkə, günahlardan çəkinəsiniz!
Ey iman gətirənlər, bütövlüklə İslama daxil olun! Şeytanın addımlarını izləməyin! Şübhəsiz ki, o sizin açıq-aydın düşməninizdir.
Ey iman gətirənlər! Həqiqətən, içki, qumar, bütlər və fal oxları şeytan əməli olan murdar şeylərdir. Bunlardan uzaq durun ki, bəlkə nicat tapasınız!
Ey iman gətirənlər! “Allah yolunda döyüşə çıxın!” - deyildiyi zaman sizə nə oldu ki, yerə yapışıb qaldınız. Axirətin əvəzinə dünya həyatına razı oldunuz?
Dünya malı axirət nemətlərinin yanında çox az bir şeydir.
Həqiqətən, insan çox zalım və çox nankordur."""
question = "Allah kiminlədir ?"
answer = answer_question(context, question)
print(answer)
This model licensed under the CC BY-NC-ND 4.0 license. What does this license allow?
Attribution: You must give appropriate credit, provide a link to the license, and indicate if changes were made.
Non-Commercial: You may not use the material for commercial purposes.
No Derivatives: If you remix, transform, or build upon the material, you may not distribute the modified material.
For more information, please refer to the <a target="_blank" href="https://creativecommons.org/licenses/by-nc-nd/4.0/">CC BY-NC-ND 4.0 license</a>.
@misc {localdoc_2024,
author = { {LocalDoc} },
title = { mbart_large_qa_azerbaijan (Revision 7484a07) },
year = 2024,
url = { https://huggingface.co/LocalDoc/mbart_large_qa_azerbaijan },
doi = { 10.57967/hf/2541 },
publisher = { Hugging Face }
}
For more information, questions, or issues, please contact LocalDoc at [[email protected]].