Update README.md
Browse files
README.md
CHANGED
@@ -1,7 +1,91 @@
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
-
tags:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
+
tags:
|
4 |
+
- Turkish
|
5 |
+
- TR
|
6 |
+
- ORPO
|
7 |
+
datasets:
|
8 |
+
- selimc/orpo-dpo-mix-TR-20k
|
9 |
+
language:
|
10 |
+
- tr
|
11 |
+
base_model:
|
12 |
+
- google/gemma-2-9b-it
|
13 |
---
|
14 |
|
15 |
+
# OrpoGemma-2-9B-TR
|
16 |
+
|
17 |
+
OrpoGemma-2-9B-TR is a Turkish fine-tuned version of [google/gemma-2-9b-it](https://huggingface.co/google/gemma-2-9b-it). It is trained using ORPO on a subset of 1500 rows from the dataset [selimc/orpo-dpo-mix-TR-20k](https://huggingface.co/datasets/selimc/orpo-dpo-mix-tr-20k).
|
18 |
+
|
19 |
+
## Training Information
|
20 |
+
|
21 |
+
- **Base Model**: [google/gemma-2-9b-it](https://huggingface.co/google/gemma-2-9b-it)
|
22 |
+
- **Fine-Tuning Technique**: ORPO
|
23 |
+
- **Training Data**: 1500 rows from [selimc/orpo-dpo-mix-TR-20k](https://huggingface.co/datasets/selimc/orpo-dpo-mix-tr-20k)
|
24 |
+
- **Training Time**: 2.5 hours on NVIDIA H100
|
25 |
+
|
26 |
+
### QLoRA Configurations:
|
27 |
+
- `lora_r`: 64
|
28 |
+
- `lora_alpha`: 32
|
29 |
+
- `lora_dropout`: 0.05
|
30 |
+
|
31 |
+
### ORPO Training Parameters
|
32 |
+
- `lr`: 2e-6
|
33 |
+
- `epochs`: 3
|
34 |
+
- `Per Device Train Batch Size`: 8
|
35 |
+
- `Gradient Accumulation Steps`: 4
|
36 |
+
|
37 |
+
## 📈 Training Curves
|
38 |
+
|
39 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/65281302cad797fc4abeffd7/bdhWq-TbvQ-h_aSQDf2pv.png)
|
40 |
+
|
41 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/65281302cad797fc4abeffd7/HUn3oZyiYA5dVf-fqPM7w.png)
|
42 |
+
|
43 |
+
## Model Capabilities
|
44 |
+
|
45 |
+
- Generates fluent and coherent text in Turkish.
|
46 |
+
- Provides more informative and detailed responses to different types of instructions and question types.
|
47 |
+
- May still produce incorrect or nonsensical outputs, user verification is recommended.
|
48 |
+
|
49 |
+
## How to Use
|
50 |
+
|
51 |
+
```python
|
52 |
+
from transformers import pipeline, BitsAndBytesConfig, AutoTokenizer
|
53 |
+
import torch
|
54 |
+
|
55 |
+
bnb_config = BitsAndBytesConfig(
|
56 |
+
load_in_4bit=True,
|
57 |
+
bnb_4bit_use_double_quant=True,
|
58 |
+
bnb_4bit_quant_type="nf4",
|
59 |
+
bnb_4bit_compute_dtype=torch.bfloat16
|
60 |
+
)
|
61 |
+
|
62 |
+
model_id = "selimc/OrpoGemma-2-9B-TR"
|
63 |
+
|
64 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
65 |
+
|
66 |
+
pipe = pipeline(
|
67 |
+
"text-generation",
|
68 |
+
model=model_id,
|
69 |
+
model_kwargs={"torch_dtype": torch.bfloat16 ,'quantization_config': bnb_config},
|
70 |
+
tokenizer=tokenizer,
|
71 |
+
device_map="auto"
|
72 |
+
)
|
73 |
+
|
74 |
+
messages = [
|
75 |
+
{"role": "user", "content": "Gökyüzü neden mavi?"},
|
76 |
+
]
|
77 |
+
|
78 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
79 |
+
|
80 |
+
outputs = pipe(
|
81 |
+
prompt,
|
82 |
+
max_new_tokens=512,
|
83 |
+
do_sample=True,
|
84 |
+
temperature=0.3,
|
85 |
+
top_p=0.9
|
86 |
+
)
|
87 |
+
|
88 |
+
generated_text = outputs[0]['generated_text']
|
89 |
+
response = generated_text[len(prompt):].strip()
|
90 |
+
print(response)
|
91 |
+
```
|