bezir commited on
Commit
964655d
·
verified ·
1 Parent(s): f56b44d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +165 -34
README.md CHANGED
@@ -1,60 +1,191 @@
1
  ---
2
- base_model: Qwen/Qwen2.5-7B-Instruct
3
- datasets: WiroAI/dolphin-r1-italian
4
  library_name: transformers
5
- model_name: Qwen2.5-7B-Open-R1-Distill-Italian
6
  tags:
7
  - generated_from_trainer
8
- - open-r1
9
  - trl
10
  - sft
11
  licence: license
 
 
 
 
 
12
  ---
13
 
14
- # Model Card for Qwen2.5-7B-Open-R1-Distill-Italian
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- This model is a fine-tuned version of [Qwen/Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) on the [WiroAI/dolphin-r1-italian](https://huggingface.co/datasets/WiroAI/dolphin-r1-italian) dataset.
17
- It has been trained using [TRL](https://github.com/huggingface/trl).
18
 
19
- ## Quick start
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  ```python
22
- from transformers import pipeline
23
 
24
- question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"
25
- generator = pipeline("text-generation", model="bezir/Qwen2.5-7B-Open-R1-Distill-Italian", device="cuda")
26
- output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
27
- print(output["generated_text"])
28
- ```
29
 
30
- ## Training procedure
 
 
 
 
 
31
 
32
- [<img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in Weights & Biases" width="150" height="24"/>](https://wandb.ai/bezirglasgow/huggingface/runs/a4k6nluk)
33
 
 
 
 
 
34
 
35
- This model was trained with SFT.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
- ### Framework versions
38
 
39
- - TRL: 0.16.0.dev0
40
- - Transformers: 4.49.0
41
- - Pytorch: 2.5.1
42
- - Datasets: 3.3.2
43
- - Tokenizers: 0.21.0
44
 
45
- ## Citations
 
 
 
46
 
 
 
47
 
 
48
 
49
- Cite TRL as:
50
-
51
- ```bibtex
52
- @misc{vonwerra2022trl,
53
- title = {{TRL: Transformer Reinforcement Learning}},
54
- author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallouédec},
55
- year = 2020,
56
- journal = {GitHub repository},
57
- publisher = {GitHub},
58
- howpublished = {\url{https://github.com/huggingface/trl}}
59
  }
60
  ```
 
1
  ---
2
+ datasets: WiroAI/dolphin-r1-Italian
 
3
  library_name: transformers
4
+ model_name: OpenR1-Qwen-7B-Italian
5
  tags:
6
  - generated_from_trainer
 
7
  - trl
8
  - sft
9
  licence: license
10
+ license: apache-2.0
11
+ language:
12
+ - it
13
+ base_model:
14
+ - Qwen/Qwen2.5-7B-Instruct
15
  ---
16
 
17
+ <div align="center" style="display: flex; justify-content: center; align-items: center;">
18
+ <img src="https://huggingface.co/WiroAI/wiroai-turkish-llm-9b/resolve/main/wiro_logo.png" width="15%" alt="Wiro AI" />
19
+ <img src="https://upload.wikimedia.org/wikipedia/en/0/03/Flag_of_Italy.svg" width="15%" alt="Italian Flag" style="margin-left: 10px;" />
20
+ </div>
21
+ <hr>
22
+ <div align="center" style="line-height: 1;">
23
+ <a href="https://www.wiro.ai/" target="_blank" style="margin: 2px;">
24
+ <img alt="Homepage" src="https://huggingface.co/WiroAI/wiroai-turkish-llm-9b/resolve/main/homepage.svg" style="display: inline-block; vertical-align: middle;"/>
25
+ </a>
26
+ <a href="https://wiro.ai/tools?search=&categories=chat&tags=&page=0" target="_blank" style="margin: 2px;">
27
+ <img alt="Chat" src="https://huggingface.co/WiroAI/wiroai-turkish-llm-9b/resolve/main/chat.svg" style="display: inline-block; vertical-align: middle;"/>
28
+ </a>
29
+ <a href="https://huggingface.co/WiroAI" target="_blank" style="margin: 2px;">
30
+ <img alt="Hugging Face" src="https://huggingface.co/WiroAI/wiroai-turkish-llm-9b/resolve/main/huggingface.svg" style="display: inline-block; vertical-align: middle;"/>
31
+ </a>
32
+ </div>
33
+ <div align="center" style="line-height: 1;">
34
+ <a href="https://instagram.com/wiroai" target="_blank" style="margin: 2px;">
35
+ <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;"/>
36
+ </a>
37
+ <a href="https://x.com/wiroai" target="_blank" style="margin: 2px;">
38
+ <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;"/>
39
+ </a>
40
+ </div>
41
+ <div align="center" style="line-height: 1;">
42
+ <a href="https://wiro.ai/agreement/terms-of-service" style="margin: 2px;">
43
+ <img alt="License" src="https://img.shields.io/badge/License-apache 2.0-f5de53?&color=f5de53" style="display: inline-block; vertical-align: middle;"/>
44
+ </a>
45
+ </div>
46
 
47
+ # 🚀 OpenR1-Qwen-7B-Italian 🚀
 
48
 
49
+ This is a finetune of [Qwen2.5-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) on [WiroAI/dolphin-r1-Italian](https://huggingface.co/datasets/WiroAI/dolphin-r1-Italian).
50
+
51
+ ## 🟢 Overview
52
+
53
+ - DeepSeek's distilled models sometimes reason in Chinese or English even though prompted in another language.
54
+ - Open-Source models still need improvement on relatively low-resource languages.
55
+ - A motivation to reproduce R1 and contribute to the community.
56
+
57
+ ## 🟢 Training
58
+
59
+ - We train the model on the [WiroAI/dolphin-r1-Italian](https://huggingface.co/datasets/WiroAI/dolphin-r1-Italian) 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.
60
+ - Training took 5 days in 8xA6000 ADA cluster.
61
+ - 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.
62
+
63
+ You can find the training and evaluation code at: https://github.com/huggingface/open-r1/
64
+
65
+ ## 🐨 Quick start
66
 
67
  ```python
68
+ from transformers import AutoModelForCausalLM, AutoTokenizer
69
 
70
+ model_name = "OpenR1-Qwen-7B-Italian"
 
 
 
 
71
 
72
+ model = AutoModelForCausalLM.from_pretrained(
73
+ model_name,
74
+ torch_dtype="auto",
75
+ device_map="auto"
76
+ )
77
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
78
 
79
+ prompt = "Trova il valore di $x$ che soddisfa l'equazione $4x+5 = 6x+7$."
80
 
81
+ messages = [
82
+ {"role": "system", "content": "Si prega di ragionare passo dopo passo prima di rispondere."},
83
+ {"role": "user", "content": prompt}
84
+ ]
85
 
86
+ text = tokenizer.apply_chat_template(
87
+ messages,
88
+ tokenize=False,
89
+ add_generation_prompt=True
90
+ )
91
+ model_inputs = tokenizer([text], return_tensors="pt").to(device)
92
+
93
+ generated_ids = model.generate(
94
+ model_inputs.input_ids,
95
+ max_new_tokens=4096
96
+ )
97
+ generated_ids = [
98
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
99
+ ]
100
+
101
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
102
+ ```
103
+
104
+ ```
105
+ <|begin_of_thought|>
106
+ Ok, allora devo risolvere l'equazione 4x + 5 uguale a 6x + 7 per x.
107
+ Mmm, vediamo. Ricordo dalle lezioni di algebra che quando hai un'equazione come questa, vuoi isolare la variabile su un lato.
108
+ Probabilmente significa portare tutti i termini con la x da una parte e le costanti dall'altra. Cerchiamo di ricordare i passaggi esatti.
109
+ Innanzitutto, forse posso sottrarre 4x da entrambi i lati per eliminare il 4x a sinistra. Proviamo. Se sottraggo 4x da entrambi i lati, otterrei:
110
+ 4x + 5 - 4x = 6x + 7 - 4x
111
+ Semplificando entrambi i lati, il 4x e il -4x sul lato sinistro si annullano, lasciando solo 5. Sul lato destro, 6x meno 4x fa 2x. Quindi ora l'equazione è:
112
+ 5 = 2x + 7\n\nOk, sembra più semplice. Ora, devo ottenere x da sola.
113
+ Il termine costante al lato destro è 7, quindi forse posso sottrarre 7 da entrambi i lati per sbarazzarmene.
114
+ Facciamolo: 5 - 7 = 2x + 7 - 7\n\nSemplificando entrambi i lati: 5 - 7 fa -2, e 7 - 7 si annulla, lasciando 2x.
115
+ Quindi ora abbiamo: -2 = 2x
116
+ Mmm, quindi 2x è uguale a -2. Per risolvere per x, dovrei dividere entrambi i lati per 2. Verifichiamo:
117
+ (-2) / 2 = (2x)/2
118
+ Che si semplifica in: -1 = x
119
+ Quindi x è uguale a -1. Vediamo se ha senso. Sostituiamo x = -1 nell'equazione originale per verificare.
120
+ Lato sinistro: 4*(-1) + 5 = -4 + 5 = 1
121
+ Lato destro: 6*(-1) + 7 = -6 + 7 = 1
122
+ Oh, entrambi i lati sono uguali a 1. Funziona! Quindi x = -1 è effettivamente la soluzione corretta.
123
+ Aspetta, ma voglio assicurarmi di non aver fatto errori nei miei passaggi. Ripercorriamo di nuovo ogni passaggio.
124
+ Equazione originale: 4x + 5 = 6x + 7
125
+ Passaggio 1: Sottrai 4x da entrambi i lati. Questo dà 5 = 2x + 7. Sembra giusto perché 4x - 4x è 0, quindi rimane 5, e 6x - 4x è 2x.
126
+ Passaggio 2: Sottrai 7 da entrambi i lati. Questo dà 5 - 7 = 2x, che è -2 = 2x. Corretto.
127
+ Passaggio 3: Dividi entrambi i lati per 2. -2 diviso per 2 è -1, quindi x = -1. Sì, torna tutto.
128
+ Un altro modo per affrontarlo potrebbe essere quello di sottrarre prima 5 da entrambi i lati invece di sottrarre 4x.
129
+ Proviamo questo metodo per confermare.\n\nPartendo da 4x + 5 = 6x + 7
130
+ Sottrai 5 da entrambi i lati: 4x = 6x + 2
131
+ Ora, sottrai 6x da entrambi i lati: 4x - 6x = 2
132
+ Che dà -2x = 2\n\nDividi entrambi i lati per -2: x = 2 / (-2) = -1
133
+ Stesso risultato. Ok, quindi sia che io sottragga prima 4x o 5, finisco comunque con x = -1. Questo mi dà più fiducia che la soluzione sia corretta.
134
+ In alternativa, potrei anche usare l'addizione di equazioni. Vediamo. Se voglio avere tutti i termini con x su un lato e le costanti sull'altro, posso riorganizzare l'equazione iniziale.
135
+ Sottrai 4x e 7 da entrambi i lati contemporaneamente.\n\nAspetta, forse no. Pensiamoci. L'idea è quella di spostare tutti i termini con x a sinistra e le costanti a destra.
136
+ Quindi partendo da 4x + 5 = 6x + 7\n\nSe sottraggo 4x da entrambi i lati, come ho fatto prima, ottengo 5 = 2x + 7.
137
+ In alternativa, se sottraggo 6x e 5 da entrambi i lati, sarebbe: 4x + 5 - 6x - 5 = 6x + 7 - 6x - 5
138
+ Semplificando il lato sinistro: (4x - 6x) + (5 - 5) = -2x + 0 = -2x
139
+ Lato destro: (6x - 6x) + (7 - 5) = 0 + 2 = 2
140
+ Quindi, -2x = 2, portando a x = -1. Stessa risposta. Quindi indipendentemente dal metodo, è coerente.
141
+ Un altro controllo: visualizziamo l'equazione. Il lato sinistro è 4x + 5, che è una linea con pendenza 4 e intercetta y a 5.
142
+ Il lato destro è 6x + 7, una linea con pendenza 6 e intercetta y a 7. L'equazione chiede dove queste due linee si intersecano.
143
+ Poiché hanno pendenze diverse, dovrebbero intersecarsi esattamente in un punto. La nostra soluzione x = -1 è dove si incrociano.
144
+ Verifichiamo con un grafico approssimativo.
145
+ A x = -1, il lato sinistro è 4*(-1) + 5 = -4 + 5 = 1. Il lato destro è 6*(-1) + 7 = -6 + 7 = 1. Quindi entrambe le linee passano per ( -1, 1 ). Ha senso.
146
+ Se le linee avessero la stessa pendenza, sarebbero parallele e non si intersecherebbero mai, ma poiché le loro pendenze sono diverse (4 contro 6), devono intersecarsi esattamente una volta.
147
+ Pertanto, x = -1 è l'unica soluzione. C'è qualche possibilità che abbia commesso un errore aritmetico? Ricontrolliamo di nuovo ogni passaggio.
148
+ Equazione originale: 4x + 5 = 6x + 7
149
+ Sottrai 4x: 5 = 2x + 7 Sottrai 7: -2 = 2x Dividi per 2: -1 = x
150
+ Tutte le operazioni sono aritmetiche semplici. Sottrarre 4x e 7, quindi dividere per 2. Nessun problema lì. In alternativa, se inserisco x = -1 nell'equazione originale, come ho fatto prima, entrambi i lati sono uguali a 1, quindi funziona.
151
+ Penso che sia completo. Non riesco a vedere errori nel mio ragionamento. Tutti i diversi metodi portano alla stessa risposta e la verifica sostituendo nell'equazione originale conferma che è corretta.
152
+ Pertanto, sono sicuro che x = -1 sia la soluzione giusta.
153
+ **Risposta finale** Il valore di \\( x \\) che soddisfa l'equazione è \\boxed{-1}.
154
+ <|end_of_thought|>
155
+
156
+ <|begin_of_solution|>
157
+ Per risolvere l'equazione (4x + 5 = 6x + 7) per (x):
158
+ 1. Sottrai (4x) da entrambi i lati: [4x + 5 - 4x = 6x + 7 - 4x]
159
+ Semplificando, otteniamo: [5 = 2x + 7]
160
+ 2. Sottrai 7 da entrambi i lati: [5 - 7 = 2x + 7 - 7]
161
+ Semplificando, otteniamo: [-2 = 2x]
162
+ 3. Dividi entrambi i lati per 2: [-2/2 = 2x/2]
163
+ Semplificando, otteniamo: [-1 = x]
164
+ Verifica sostituendo (x = -1) nell'equazione originale:
165
+ - Lato sinistro: (4(-1) + 5 = -4 + 5 = 1)
166
+ - Lato destro: (6(-1) + 7 = -6 + 7 = 1)
167
+ Entrambi i lati sono uguali a 1, confermando che la soluzione è corretta.
168
+ <|end_of_solution|>
169
+ ```
170
 
 
171
 
172
+ ## 🟡 Evaluation
 
 
 
 
173
 
174
+ - We observed that reasoning process has slightly improved. Our model thinks more clearly in Italian compared to the DeepSeek's reasoning model.
175
+ - 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.
176
+ - 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.
177
+ - We believe democratized and culturally improved open-source models will be through sharing and experiments!
178
 
179
+ ## 🤗 Community
180
+ - We would like to thank Huggingface Staff and everyone who contributed to the Open-R1 project!
181
 
182
+ ## Citation
183
 
184
+ ```none
185
+ @article{WiroAI,
186
+ title={WiroAI/OpenR1-Qwen-7B-Italian,
187
+ author={Abdullah Bezir, Cengiz Asmazoğlu},
188
+ year={2025},
189
+ url={https://huggingface.co/WiroAI/OpenR1-Qwen-7B-Italian}
 
 
 
 
190
  }
191
  ```