File size: 9,313 Bytes
d07b4df
dd3be49
d07b4df
9d650f9
d07b4df
 
 
 
b6185d3
 
 
 
d07b4df
9d650f9
 
 
f9017bf
 
d07b4df
 
b6185d3
9d650f9
b6185d3
9d650f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d07b4df
8b560f6
9d650f9
 
d07b4df
8b560f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d07b4df
 
9d650f9
d07b4df
9d650f9
d07b4df
9d650f9
 
 
 
 
 
d07b4df
9d650f9
d07b4df
9d650f9
 
 
 
552e743
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9d650f9
d07b4df
a2e1d41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d07b4df
8b560f6
d07b4df
4dddd60
 
3f9a41b
4dddd60
8b560f6
 
 
5a9ad45
 
 
 
 
 
 
 
 
 
b6185d3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
---
datasets: WiroAI/dolphin-r1-turkish
library_name: transformers
model_name: OpenR1-Qwen-7B-Turkish
tags:
- generated_from_trainer
- trl
- sft
- thinking
- reasoning
- deepseek
- qwen
licence: license
license: apache-2.0
language:
- tr
base_model:
- Qwen/Qwen2.5-7B-Instruct
---

<div align="center" style="display: flex; justify-content: center; align-items: center;">
  <img src="https://huggingface.co/WiroAI/wiroai-turkish-llm-9b/resolve/main/wiro_logo.png" width="15%" alt="Wiro AI" />
  <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Flag_of_Turkey.svg/1599px-Flag_of_Turkey.svg.png" width="15%" alt="Turkish Flag" style="margin-left: 10px;" />
</div>
<hr>
<div align="center" style="line-height: 1;">
  <a href="https://www.wiro.ai/" target="_blank" style="margin: 2px;">
    <img alt="Homepage" src="https://huggingface.co/WiroAI/wiroai-turkish-llm-9b/resolve/main/homepage.svg" style="display: inline-block; vertical-align: middle;"/>
  </a>
  <a href="https://wiro.ai/tools?search=&categories=chat&tags=&page=0" target="_blank" style="margin: 2px;">
    <img alt="Chat" src="https://huggingface.co/WiroAI/wiroai-turkish-llm-9b/resolve/main/chat.svg" style="display: inline-block; vertical-align: middle;"/>
  </a>
  <a href="https://huggingface.co/WiroAI" target="_blank" style="margin: 2px;">
    <img alt="Hugging Face" src="https://huggingface.co/WiroAI/wiroai-turkish-llm-9b/resolve/main/huggingface.svg" style="display: inline-block; vertical-align: middle;"/>
  </a>
</div>
<div align="center" style="line-height: 1;">
  <a href="https://instagram.com/wiroai" target="_blank" style="margin: 2px;">
    <img alt="Instagram Follow" src="https://img.shields.io/badge/Instagram-wiroai-555555?logo=instagram&logoColor=white&labelColor=E4405F" style="display: inline-block; vertical-align: middle;"/>
  </a>
    <a href="https://x.com/wiroai" target="_blank" style="margin: 2px;">
    <img alt="X Follow" src="https://img.shields.io/badge/X-wiroai-555555?logo=x&logoColor=white&labelColor=000000" style="display: inline-block; vertical-align: middle;"/>
  </a>
</div>
<div align="center" style="line-height: 1;">
  <a href="https://wiro.ai/agreement/terms-of-service" style="margin: 2px;">
    <img alt="License" src="https://img.shields.io/badge/License-apache 2.0-f5de53?&color=f5de53" style="display: inline-block; vertical-align: middle;"/>
  </a>
</div>

# 🚀 OpenR1-Qwen-7B-Turkish 🚀

This is a finetune of [Qwen2.5-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) on [WiroAI/dolphin-r1-turkish](https://huggingface.co/datasets/WiroAI/dolphin-r1-turkish).

## 🟢 Overview 

- DeepSeek's distilled models sometimes reason in Chinese or English even though prompted in another language.
- Open-Source models still need improvement on relatively low-resource languages.
- A motivation to reproduce R1 and contribute to the community.

## 🟢 Training 

- We train the model on the [WiroAI/dolphin-r1-turkish](https://huggingface.co/datasets/WiroAI/dolphin-r1-turkish) for 2 epochs. We use learning rate of 1e-5 and max seq length 4096. The training follows a cosine learning rate schedule with a 10% warmup phase. 
- Training took 3 days in 8xA6000 ADA cluster.
- Normally, R1 team compares the performance of OpenR1 models to DeepSeek-Distill-Qwen-7B and OpenThinker-7B using [lighteval](https://github.com/huggingface/open-r1/tree/main?tab=readme-ov-file#evaluating-models). However, the datasets are only MATH oriented so not to conclude anything we won't disclose the default results.

You can find the training and evaluation code at: https://github.com/huggingface/open-r1/

## 🐨 Quick start

```python
from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "OpenR1-Qwen-7B-Turkish"

model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype="auto",
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)

prompt = "$4x+5 = 6x+7$ denklemini sağlayan $x$ değerini bul."

messages = [
    {"role": "system", "content": "Lütfen adım adım düşün ve cevapla."},
    {"role": "user", "content": prompt}
]

text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(device)

generated_ids = model.generate(
    model_inputs.input_ids,
    max_new_tokens=4096
)
generated_ids = [
    output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]

response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
```

```
<|begin_of_thought|>
Tamam, yani 4x + 5 = 6x + 7 denklemini çözmem gerekiyor. Hımm, dur bakalım.
Cebirden hatırlıyorum ki denklemi doğru yapacak x değerini bulmam lazım.
Adım adım düşüneyim. Öncelikle, belki tüm x terimlerini bir tarafa ve sabitleri diğer tarafa almalıyım.
Bu şekilde, x'i yalnız bırakabilirim. Sol tarafta 4x var ve sağ tarafta 6x var.
Yani, her iki taraftan 4x çıkarırsam, bu bana 5 = 2x + 7 sonucunu verir. Dur, doğru mu? Kontrol edeyim.
Eğer orijinal denklem 4x + 5 = 6x + 7 ise ve her iki taraftan 4x çıkarırsam, evet, sol taraf 5 olur ve sağ taraf 6x - 4x, yani 2x olur, artı 7.
Yani şimdi 5 = 2x + 7 oldu. Pekala, şimdi 5 = 2x + 7'ye sahibim.
Bir sonraki adım, x'i çözmem gereken 2x'i izole etmek. Bu yüzden her iki taraftan 7 çıkarmalıyım.
Bunu yazayım. Her iki taraftan 7 çıkar: 5 - 7 = 2x + 7 - 7. Sağ tarafı basitleştirirsek, 7 - 7, 0 olur, yani 5 - 7 = 2x. Bu da -2 = 2x'e basitleşir.
Şimdi denklem -2 = 2x. x'i çözmek için her iki tarafı 2'ye bölmem gerekiyor.
Yapayım. Her iki tarafı 2'ye bölmek: (-2)/2 = (2x)/2. Bu da -1 = x'e basitleşir veya aynı şey x = -1.
Dur, bunun mantıklı olup olmadığını kontrol edeyim. x = -1'i orijinal denkleme geri takarak işe yarayıp yaramadığını doğrulayayım.
Orijinal denklem: 4x + 5 = 6x + 7. x = -1'i yerine koyarsak: Sol taraf: 4*(-1) + 5 = -4 + 5 = 1. Sağ taraf: 6*(-1) + 7 = -6 + 7 = 1.
Yani her iki taraf da 1'e eşit. Bu doğru. Yani x = -1 gerçekten de çözüm.
Ama hata yapmadığımdan emin olmak için adımları tekrar gözden geçireyim. 4x + 5 = 6x + 7 ile başlayarak.
Her iki taraftan 4x çıkar: 5 = 2x + 7. Sonra 7 çıkar: 5 - 7 = 2x => -2 = 2x. 2'ye böl: x = -1.
Evet, hepsi doğru görünüyor. Alternatif olarak, bu probleme yaklaşmanın başka bir yolu da önce tüm x terimlerini bir tarafa toplamak olabilir.
Bakalım. Eğer her iki taraftan 4x çıkarıp her iki taraftan 7 çıkarırsam, bu bana 5 - 7 = 6x - 4x sonucunu verir, bu da -2 = 2x demektir.
Sonra aynı sonuç. Yani yöntemden bağımsız olarak, aynı cevabı alıyoruz. Başka bir kontrol yolu da sayı doğrusu üzerinde düşünmek olabilir.
Eğer 4x + 5, 6x + 7'ye eşitse, o zaman 4x + 5'ten 6x + 7'ye olan mesafe sıfır olmalı.
Ama belki de bu işleri karmaşıklaştırıyor. Alternatif olarak, her iki taraftan 4x çıkararak 5 = 2x + 7 elde edelim. Sonra 7 çıkar: -2 = 2x.
Yani x, -1'dir. Evet, aynı cevap. Sanırım bu sağlam. Tüm adımlar kontrol edildi ve x = -1'i orijinal denkleme geri koymak işe yarıyor.
Yani çözüm x = -1 olmalı.
**Son Cevap** \\( x \\) değeri \\boxed{-1}'dir.
<|end_of_thought|>

<|begin_of_solution|>\n\\(4x + 5 = 6x + 7\\) denklemini çözmek için:\n\n1. Tüm \\(x\\) terimlerini bir tarafa ve sabitleri diğer tarafa taşımak için her iki taraftan \\(4x\\) çıkarın:\n   \\[\n   4x + 5 - 4x = 6x + 7 - 4x\n   \\]\n   Bunu basitleştirdiğimizde şunu elde ederiz:\n   \\[\n   5 = 2x + 7\n   \\]\n\n2. \\(x\\) terimini yalnız bırakmak için her iki taraftan 7 çıkarın:\n   \\[\n   5 - 7 = 2x + 7 - 7\n   \\]\n   Bunu basitleştirdiğimizde şunu elde ederiz:\n   \\[\n   -2 = 2x\n   \\]\n\n3. Her iki tarafı 2'ye bölerek \\(x\\) için çözün:\n   \\[\n   \\frac{-2}{2} = \\frac{2x}{2}\n   \\]\n   Bunu basitleştirdiğimizde şunu elde ederiz:\n   \\[\n   x = -1\n   \\]\n\nDoğrulama: \\(x = -1\\)'i orijinal denklemde yerine koyun:\n- Sol taraf: \\(4(-1) + 5 = -4 + 5 = 1\\)\n- Sağ taraf: \\(6(-1) + 7 = -6 + 7 = 1\\)\n\nHer iki taraf da eşit olduğundan, çözümün doğru olduğu doğrulanır.\n\n\\(x\\) değeri \\(\\boxed{-1}\\)'dir.\n<|end_of_solution|>
```


## 🟡 Evaluation

- We observed that reasoning process has slightly improved. Our model thinks more clearly in Turkish compared to the DeepSeek's reasoning model.
- This model trained for experimental motives and any benchmark evaluation is appreciated. Please be aware that this model will be producing more tokens compared to normal models and will consume more VRAM during inference.
- If you are willing to evaluate this model please make sure that model will be allowed to produce enough tokens. Generate until requests that restrict the model to output less than 4000 tokens will lead to poor results.
- We believe democratized and culturally improved open-source models will be through sharing and experiments!

## 🤗 Community
- We would like to thank Huggingface Staff and everyone who contributed to the Open-R1 project!

## Citation

```none
@article{WiroAI,
  title={WiroAI/OpenR1-Qwen-7B-Turkish,
  author={Abdullah Bezir, Cengiz Asmazoğlu},
  year={2025},
  url={https://huggingface.co/WiroAI/OpenR1-Qwen-7B-Turkish}
}
```