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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- tr
|
| 5 |
+
base_model:
|
| 6 |
+
- meta-llama/Llama-3.1-8B
|
| 7 |
+
pipeline_tag: question-answering
|
| 8 |
+
library_name: adapter-transformers
|
| 9 |
+
tags:
|
| 10 |
+
- education
|
| 11 |
+
- turkish
|
| 12 |
+
- chatbot
|
| 13 |
+
- asistant
|
| 14 |
+
---
|
| 15 |
+
# Llama3.1 Turkish Educational ChatBot
|
| 16 |
+
|
| 17 |
+
[EN]
|
| 18 |
+
|
| 19 |
+
## About the Project
|
| 20 |
+
|
| 21 |
+
This project is a fine-tuned version of the **Meta LLaMA 3.1 8B** large language model, specifically adapted to respond to **Turkish educational question-answer** prompts. The main goal is to deliver fluent, informative, and context-aware answers in Turkish, suitable for general inquiry and learning support.
|
| 22 |
+
|
| 23 |
+
The model was fine-tuned using the **LoRA** technique on a small scale (1% of trainable parameters) and published on Hugging Face:
|
| 24 |
+
|
| 25 |
+
🔗 [metehanayhan/Llama3-1_Turkish_ChatBot](https://huggingface.co/metehanayhan/Llama3-1_Turkish_ChatBot)
|
| 26 |
+
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
## Training Summary
|
| 30 |
+
|
| 31 |
+
| Feature | Value |
|
| 32 |
+
| --- | --- |
|
| 33 |
+
| Base Model | Meta LLaMA 3.1 8B |
|
| 34 |
+
| Fine-Tuning Method | Supervised Fine-Tuning (SFT) |
|
| 35 |
+
| LoRA Usage | Yes (%1 of model trained) |
|
| 36 |
+
| Training Data | Turkish question–answer pairs |
|
| 37 |
+
| Number of Training Samples | 17,587 |
|
| 38 |
+
| Epochs | 1 |
|
| 39 |
+
| Total Training Steps | 2,199 |
|
| 40 |
+
| Learning Rate | 2e-5 |
|
| 41 |
+
| Total Batch Size | 8 |
|
| 42 |
+
| Training Duration (approx.) | ~3 hours |
|
| 43 |
+
| Trainable Parameters | 83M / 8B (1.05%) |
|
| 44 |
+
| Quantization | 4-bit |
|
| 45 |
+
|
| 46 |
+
---
|
| 47 |
+
|
| 48 |
+
## Data Format
|
| 49 |
+
|
| 50 |
+
The dataset consists of Turkish question–answer pairs provided in CSV format. Each row represents a complete educational sample.
|
| 51 |
+
|
| 52 |
+
Example:
|
| 53 |
+
|
| 54 |
+
```
|
| 55 |
+
question,answer
|
| 56 |
+
What can be done to prevent climate change?,
|
| 57 |
+
"To combat climate change, actions like reducing fossil fuel usage and transitioning to renewable energy sources are essential..."
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
A total of 17,587 such examples were used for fine-tuning.
|
| 61 |
+
|
| 62 |
+
---
|
| 63 |
+
|
| 64 |
+
## Use Case
|
| 65 |
+
|
| 66 |
+
This model is intended to serve as an educational assistant in Turkish. It can answer questions related to:
|
| 67 |
+
|
| 68 |
+
- Informative, general-knowledge, or school-related topics
|
| 69 |
+
- Support for curious learners and students
|
| 70 |
+
|
| 71 |
+
---
|
| 72 |
+
|
| 73 |
+
## Quick Start
|
| 74 |
+
|
| 75 |
+
```python
|
| 76 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
|
| 77 |
+
|
| 78 |
+
tokenizer = AutoTokenizer.from_pretrained("metehanayhan/Llama3-1_Turkish_ChatBot")
|
| 79 |
+
model = AutoModelForCausalLM.from_pretrained("metehanayhan/Llama3-1_Turkish_ChatBot")
|
| 80 |
+
|
| 81 |
+
qa_pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
| 82 |
+
print(qa_pipe("İklim değişikliği neden önemlidir?", max_new_tokens=200)[0]["generated_text"])
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
---
|
| 86 |
+
|
| 87 |
+
## Performance Notes
|
| 88 |
+
|
| 89 |
+
The model performs well on Turkish QA-style prompts that resemble the training distribution:
|
| 90 |
+
|
| 91 |
+
- 🔸 Fluent and natural Turkish sentence construction
|
| 92 |
+
- 🔸 Answers are contextually aligned with the prompt
|
| 93 |
+
|
| 94 |
+
The model shows strong generalization, even with limited training, due to the LoRA technique and high-quality data.
|
| 95 |
+
|
| 96 |
+
<p align="center">
|
| 97 |
+
<img src="image.png" width="400"/>
|
| 98 |
+
</p>
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
---
|
| 102 |
+
|
| 103 |
+
## Deployment
|
| 104 |
+
|
| 105 |
+
The model is shared on Hugging Face with 4-bit quantization and is ready for low-resource inference. It has also been exported in GGUF format for use in compatible environments.
|
| 106 |
+
|
| 107 |
+
---
|
| 108 |
+
|
| 109 |
+
## Additional Notes
|
| 110 |
+
|
| 111 |
+
- The training was performed using `Trainer` with standard SFT configuration.
|
| 112 |
+
- `random_state = 3407` was used to ensure reproducibility.
|
| 113 |
+
- Although fine-tuned on just 1% of parameters, the model responds effectively across a wide range of Turkish topics.
|
| 114 |
+
|
| 115 |
+
---
|
| 116 |
+
|
| 117 |
+
[TR]
|
| 118 |
+
|
| 119 |
+
# Llama3.1 Türkçe Eğitim Odaklı ChatBot
|
| 120 |
+
|
| 121 |
+
## Proje Hakkında
|
| 122 |
+
|
| 123 |
+
Bu model, **Meta LLaMA 3.1 8B** tabanlı büyük bir dil modelidir ve Türkçe dilinde, eğitim odaklı **soru-cevap (QA)** verisiyle fine-tune edilmiştir. Amaç, kullanıcıların bilgi arayışına doğal, akıcı ve anlamlı yanıtlar sunabilen bir yardımcı oluşturmaktır.
|
| 124 |
+
|
| 125 |
+
Model, %1 oranında LoRA yöntemiyle optimize edilmiş ve Hugging Face platformuna aktarılmıştır:
|
| 126 |
+
|
| 127 |
+
🔗 [metehanayhan/Llama3-1_Turkish_ChatBot](https://huggingface.co/metehanayhan/Llama3-1_Turkish_ChatBot)
|
| 128 |
+
|
| 129 |
+
---
|
| 130 |
+
|
| 131 |
+
## Eğitim Özeti
|
| 132 |
+
|
| 133 |
+
| Özellik | Değer |
|
| 134 |
+
| --- | --- |
|
| 135 |
+
| Temel Model | Meta LLaMA 3.1 8B |
|
| 136 |
+
| Eğitim Yöntemi | Supervised Fine-Tuning (SFT) |
|
| 137 |
+
| İnce Ayar Tekniği | LoRA |
|
| 138 |
+
| Eğitim Verisi | Türkçe Eğitim Q/A |
|
| 139 |
+
| Eğitim Örneği Sayısı | 17,587 |
|
| 140 |
+
| Eğitim Epoch’u | 1 |
|
| 141 |
+
| Toplam Eğitim Adımı (steps) | 2,199 |
|
| 142 |
+
| Öğrenme Oranı | 2e-5 |
|
| 143 |
+
| Toplam Batch Size | 8 |
|
| 144 |
+
| Eğitim Süresi (yaklaşık) | 3 saat |
|
| 145 |
+
| Eğitilen Parametre Oranı | %1 (83M / 8B) |
|
| 146 |
+
| Quantization | 4-bit |
|
| 147 |
+
|
| 148 |
+
---
|
| 149 |
+
|
| 150 |
+
## Veri Formatı
|
| 151 |
+
|
| 152 |
+
Veri kümesi, her satırı bir soru-cevap çifti olan Türkçe bir CSV dosyasından oluşmaktadır. Örnek:
|
| 153 |
+
|
| 154 |
+
```
|
| 155 |
+
soru,cevap
|
| 156 |
+
İklim değişikliğine karşı neler yapılabilir?,
|
| 157 |
+
"İklim değişikliğiyle mücadele için fosil yakıt kullanımının azaltılması, yenilenebilir enerjiye geçiş gibi önlemler alınabilir..."
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
Toplam 17,587 satır veriyle eğitim gerçekleştirilmiştir.
|
| 161 |
+
|
| 162 |
+
---
|
| 163 |
+
|
| 164 |
+
## Amaç ve Kullanım Alanı
|
| 165 |
+
|
| 166 |
+
Model, aşağıdaki türde sorulara doğal dilde bilgi sunmak amacıyla geliştirilmi��tir:
|
| 167 |
+
|
| 168 |
+
- Açıklayıcı, öğretici, genel kültür soruları
|
| 169 |
+
- Öğrencilerin veya meraklı bireylerin bilgi edinme taleplerine destek
|
| 170 |
+
- Cevap üretimi sırasında özgün, tutarlı ve doğal Türkçe dil kullanımı
|
| 171 |
+
|
| 172 |
+
---
|
| 173 |
+
|
| 174 |
+
## Hızlı Başlangıç
|
| 175 |
+
|
| 176 |
+
```python
|
| 177 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
|
| 178 |
+
|
| 179 |
+
tokenizer = AutoTokenizer.from_pretrained("metehanayhan/Llama3-1_Turkish_ChatBot")
|
| 180 |
+
model = AutoModelForCausalLM.from_pretrained("metehanayhan/Llama3-1_Turkish_ChatBot")
|
| 181 |
+
|
| 182 |
+
qa_pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
| 183 |
+
print(qa_pipe("İklim değişikliği neden önemlidir?", max_new_tokens=1024)[0]["generated_text"])
|
| 184 |
+
```
|
| 185 |
+
|
| 186 |
+
---
|
| 187 |
+
|
| 188 |
+
## Performans
|
| 189 |
+
|
| 190 |
+
Model, eğitim verisine benzer sorularda oldukça doğal, akıcı ve içerik açısından doyurucu cevaplar üretmektedir. LoRA yöntemi sayesinde düşük hesaplama kaynağı ile etkili bir öğrenme gerçekleştirilmiştir. Eğitim sırasında gözlemlenen bazı bulgular:
|
| 191 |
+
|
| 192 |
+
- 🔸 Cevaplar Türkçe dil yapısına uygun
|
| 193 |
+
- 🔸 Soruyla bağlamsal olarak ilişkili
|
| 194 |
+
|
| 195 |
+
<p align="center">
|
| 196 |
+
<img src="image.png" width="400"/>
|
| 197 |
+
</p>
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
---
|
| 201 |
+
|
| 202 |
+
## Yayınlama
|
| 203 |
+
|
| 204 |
+
Model, Hugging Face üzerinde quantize edilmiş biçimde (4-bit) paylaşılmıştır ve inference için kullanıma hazırdır. GGUF biçimiyle de dışa aktarılmıştır.
|
| 205 |
+
|
| 206 |
+
---
|
| 207 |
+
|
| 208 |
+
## Notlar
|
| 209 |
+
|
| 210 |
+
- Eğitim random_state=3407 ile tekrarlanabilirlik için sabitlenmiştir.
|
| 211 |
+
- Eğitim süreci `Trainer` altyapısıyla gerçekleştirilmiş ve standart veri ön işleme yapılmıştır.
|
| 212 |
+
- Model, küçük eğitimle geniş bilgi alanlarında doğal cevaplar üretme yeteneğine sahiptir.
|
| 213 |
+
|
| 214 |
+
---
|