--- library_name: transformers tags: - question - nlp - question answering - bart - mbart - turkish license: mit language: - tr base_model: - facebook/mbart-large-50 pipeline_tag: question-answering --- # Model Card for Model ID This model is a **fine-tuned version of `facebook/mbart-large-50`** for **Abstractive Question Answering (QA) in Turkish**, trained on a legal text dataset based on Turkish laws. Unlike extractive QA models that select exact spans from the context, this model **generates natural, paraphrased answers**. ## Model Details ### Model Description - **Base Model**: [facebook/mbart-large-50](https://huggingface.co/facebook/mbart-large-50) - **Task**: Abstractive Question Answering (Text-to-Text Generation) - **Language**: Turkish (`tr_TR`) - **Dataset**: Custom dataset containing **legal texts** from Turkish law. - **Training Data**: 8,630 examples for training and 959 for validation. - **Fine-tuning Framework**: Hugging Face Transformers (`Seq2SeqTrainer`) ## How to Get Started with the Model Use the code below to get started with the model. ```python import torch from transformers import pipeline # Load the pipeline qa_pipeline = pipeline( task="text2text-generation", model="yeniguno/turkish-law-aqa-bart-finetuned", tokenizer="yeniguno/turkish-law-aqa-bart-finetuned", device=0 if torch.cuda.is_available() else -1 ) # Example question and context context = """ madde 281 (1) gerçeğin meydana çıkmasını engellemek amacıyla, bir suçun delillerini yok eden, silen, gizleyen, türk ceza kanunu değiştiren veya bozan kişi, altı aydan beş yıla kadar hapis cezası ile cezalandırılır. kendi işlediği veya işlenişine iştirak ettiği suçla ilgili olarak kişiye bu fıkra hükmüne göre ceza verilmez. (2) bu suçun kamu görevlisi tarafından göreviyle bağlantılı olarak işlenmesi halinde, verilecek ceza yarı oranında artırılır. (3) ilişkin olduğu suç nedeniyle hüküm verilmeden önce gizlenen delilleri mahkemeye teslim eden kişi hakkında bu maddede tanımlanan suç nedeniyle verilecek cezanın beşte dördü indirilir. """ question = 'Kamu görevlisi tarafından işlenen bu suçun cezası ne kadar artırılır?' # Run inference input_text = question + " " + context output = qa_pipeline(input_text, max_length=128, num_beams=5, early_stopping=True) # Print result print("🔮 Model Output: ", output[0]["generated_text"]) """ 🔮 Model Output: Kamu görevlisi tarafından işlenen suçun cezası yarı oranında artırılır. Bu durumda, ceza yarı oranında artırılır. """ ``` ## Training Details - Batch Size: 4 - Learning Rate: 5e-5 - Weight Decay: 0.01 - Epochs: 5 - Optimizer: AdamW - Scheduler: Linear warmup with decay