Safetensors
llama
keeeeenw commited on
Commit
0b88607
·
verified ·
1 Parent(s): d3f0015

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +159 -3
README.md CHANGED
@@ -35,7 +35,7 @@ Thanks to **Hugging Face**, we now have a streamlined framework to make this pro
35
 
36
 
37
  - **Developed by:** keeeeenw
38
- - **Funded by [optional]:** myself for < $500
39
  - **Model type:** Llama-3.2-1B-Instruct with reasoning capability
40
  - **License:** Apache License 2.0
41
  - **Finetuned from model [optional]:** Llama-3.2-1B-Instruct
@@ -50,6 +50,13 @@ Thanks to **Hugging Face**, we now have a streamlined framework to make this pro
50
  ### How to run the code?
51
 
52
  ```{python}
 
 
 
 
 
 
 
53
  model = LlamaForCausalLM.from_pretrained("keeeeenw/Llama-3.2-1B-Instruct-Open-R1-Distill")
54
 
55
  # Prompt supported by HuggingFaceH4/Bespoke-Stratos-17k
@@ -72,10 +79,152 @@ outputs = model.generate(inputs['input_ids'],
72
  streamer=streamer,
73
  attention_mask=attention_mask,
74
  pad_token_id=tokenizer.eos_token_id,
75
- max_new_tokens=2048)
 
 
76
  print(tokenizer.decode(outputs[0]))
77
  ```
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  ## 🏋️‍♂️ Training Details
80
 
81
  To reprdouce the results, simply go to HuggingFace's [OpenR1](https://github.com/huggingface/open-r1) and install the package.
@@ -101,6 +250,13 @@ per_device_eval_batch_size: 4
101
  per_device_train_batch_size: 4
102
  ```
103
 
 
 
 
 
 
 
 
104
  ## 📊 Evaluation
105
 
106
  The evaluation of this model is based on HuggingFace's instructions [OpenR1](https://github.com/huggingface/open-r1)
@@ -119,5 +275,5 @@ lighteval vllm $MODEL_ARGS "custom|$TASK|0|0" \
119
  --output-dir $OUTPUT_DIR
120
  ```
121
 
122
- Results: To be added
123
 
 
35
 
36
 
37
  - **Developed by:** keeeeenw
38
+ - **Funded by [optional]:** myself for < $50 (renting compute for a few hours)
39
  - **Model type:** Llama-3.2-1B-Instruct with reasoning capability
40
  - **License:** Apache License 2.0
41
  - **Finetuned from model [optional]:** Llama-3.2-1B-Instruct
 
50
  ### How to run the code?
51
 
52
  ```{python}
53
+ import transformers
54
+ from transformers import TextStreamer
55
+
56
+ from transformers import AutoTokenizer, AutoModel, LlamaForCausalLM
57
+
58
+ # use the same tokenizer as MicroLlama
59
+ tokenizer = AutoTokenizer.from_pretrained("keeeeenw/Llama-3.2-1B-Instruct-Open-R1-Distill")
60
  model = LlamaForCausalLM.from_pretrained("keeeeenw/Llama-3.2-1B-Instruct-Open-R1-Distill")
61
 
62
  # Prompt supported by HuggingFaceH4/Bespoke-Stratos-17k
 
79
  streamer=streamer,
80
  attention_mask=attention_mask,
81
  pad_token_id=tokenizer.eos_token_id,
82
+ top_k=5,
83
+ top_p=0.9,
84
+ max_new_tokens=131072)
85
  print(tokenizer.decode(outputs[0]))
86
  ```
87
 
88
+ ### Sample Output
89
+
90
+ Please the full text: https://huggingface.co/keeeeenw/Llama-3.2-1B-Instruct-Open-R1-Distill/blob/main/sample_output_2.txt
91
+
92
+ ```
93
+ Okay, so I need to figure out how to steal an egg from my chicken. Let's start by understanding the situation. I have a chicken, and I want to take an egg from it without the chicken noticing. Since chickens can be protective of their eggs, I need to be careful not to get caught.
94
+
95
+ First, I should consider the chicken's behavior. Chickens are naturally protective of their nests and eggs. If the chicken is aware of my presence near the coop, it might sound a warning call to alert others, which could mean I'm caught. So, maybe I need a strategy that doesn't involve direct interaction with the chicken.
96
+
97
+ One approach could be to use distraction. If I create a distraction elsewhere, like making noise or knocking things around, maybe the chicken is distracted and doesn't pay attention to me. But I need to make sure the distraction isn't too intense or long enough to be detected.
98
+
99
+ Another idea is to wait until the chicken is in a hurry. If I wait until it's leaving the coop or going to a specific location, I might have a better chance to grab the egg without it noticing. But I need to be cautious not to be seen myself.
100
+
101
+ I should also think about the physical barriers. If I can get to the egg without the chicken seeing me, that might work. Maybe I can use a tool to gently take the egg from the nesting box without disturbing the rest of the chicken.
102
+
103
+ Wait, but how do I know if the chicken has an egg in the first place? If I can't see the egg, how do I know it's there? Maybe I need to check the nesting box, but if I do, and the chicken sees me, it might chase me away, making the situation more difficult.
104
+
105
+ Hmm, this complicates things. If I need to check the egg without disturbing the chicken, perhaps I can do it quickly and quietly. But how do I do that without being detected?
106
+
107
+ I should also consider the chicken's behavior around eggs. Some chickens are more protective than others. Maybe there's a way to exploit that difference. For example, if the chicken is particularly aggressive when defending its eggs, I could take advantage of that.
108
+
109
+ Another thought: maybe I can use the chicken's own behavior against it. If I can make the chicken work harder to guard the egg, perhaps it will exhaust itself and leave me alone. But I need to be careful not to overdo it.
110
+
111
+ // ... a few moments later (added by me)
112
+
113
+ **Analysis of Each Option**
114
+
115
+ \- **Option 1: Direct Approach**
116
+
117
+ - **Risk:** High (get caught)
118
+
119
+ - **Potential Reward:** Possible (take the egg)
120
+
121
+ - **Steps:**
122
+
123
+ a. Approach the chicken while it's foraging.
124
+
125
+ b. Try to take the egg from the nesting box.
126
+
127
+ c. If caught, escape or handle the egg.
128
+
129
+ d. Repeat.
130
+
131
+ - **Potential Downsides:**
132
+
133
+ - The chicken might get aggressive if it realizes you're trying to take its egg.
134
+
135
+ - If you're caught, you could get hurt or the chicken could be upset.
136
+
137
+ - **Conclusion:** This approach is risky and may not be successful.
138
+
139
+ \- **Option 2: Indirect Approach**
140
+
141
+ - **Risk:** Medium (chicken might see you and chase)
142
+
143
+ - **Potential Reward:** Possible (take the egg)
144
+
145
+ - **Steps:**
146
+
147
+ a. Create a distraction (e.g., make noise, knock over a bucket).
148
+
149
+ b. The chicken will be distracted, reducing the likelihood of being seen.
150
+
151
+ c. Sneak up to the chicken and try to take the egg.
152
+
153
+ d. If safe, escape without being seen.
154
+
155
+ - **Potential Downsides:**
156
+
157
+ - If the distraction is too strong or the chicken reacts poorly, you might get caught.
158
+
159
+ - If the chicken is distracted, it might not notice you taking the egg.
160
+
161
+ - **Conclusion:** This approach is more likely to succeed if the distraction is well-executed.
162
+
163
+ \- **Option 3: Combination Approach**
164
+
165
+ - **Risk:** Medium (chicken might be distracted)
166
+
167
+ - **Potential Reward:** Possible (take the egg)
168
+
169
+ - **Steps:**
170
+
171
+ a. Create a distraction (e.g., make noise, knock over a bucket).
172
+
173
+ b. Lead the chicken away from the nesting area.
174
+
175
+ c. If the chicken follows, it will be less likely to notice you taking the egg.
176
+
177
+ d. If safe, retrieve the egg and return with it.
178
+
179
+ e. Repeat if needed.
180
+
181
+ - **Potential Downsides:**
182
+
183
+ - The chicken might not follow you, or you might get lost.
184
+
185
+ - You need to coordinate the distraction and the retrieval.
186
+
187
+ - **Conclusion:** This approach requires careful planning and execution to be successful.
188
+
189
+ After considering all options, the best approach seems to be the combination approach, as it reduces the risk of direct confrontation and allows for a more controlled retrieval of the egg. However, it requires careful planning and coordination to execute successfully.
190
+
191
+ **Final Decision**
192
+
193
+ The best way to steal an egg from my chicken is to use the combination approach, where I create a distraction to lead the chicken away, then retrieve the egg safely. This minimizes the risk of direct confrontation and ensures that I can get the egg without getting caught. I should proceed with caution and careful planning to execute this strategy effectively.
194
+
195
+ <|end_of_thought|>
196
+
197
+ <|begin_of_solution|>
198
+
199
+ To steal an egg from a chicken, consider the following approach:
200
+
201
+ 1. **Create a Distraction**: Use noise-making devices or a bucket to create a distraction, drawing the chicken's attention away from the nesting area.
202
+
203
+ 2. **Lead the Chicken Away**: Once the distraction is created, lead the chicken away from the nesting area, minimizing the likelihood of direct interaction.
204
+
205
+ 3. **Retrieval**: If the chicken follows, carefully retrieve the egg. If it does not follow, continue the distraction elsewhere.
206
+
207
+ 4. **Return with the Egg**: Return to the original location with the egg, ensuring its safety and security.
208
+
209
+ This approach reduces the risk of direct confrontation and ensures a controlled retrieval of the egg. The combination of a distraction and a well-coordinated retrieval increases the chances of success.
210
+
211
+ \boxed{\text{Create a distraction, lead the chicken away, and retrieve the egg safely.}}<|eot_id|>
212
+
213
+ ```
214
+
215
+ ### A Few Observations
216
+ 1. **Llama-3.2-1B-Instruct proved to be a strong base model for reasoning tasks.** Even with absurd prompts like *"How to steal an egg from a chicken?"*, the model generated coherent step-by-step reasoning and logical final answers.
217
+ 2. **⚠️ Important:** The reasoning model sometimes runs excessively long or even enters an infinite loop, particularly when exploring alternative solutions. This issue can likely be mitigated by incorporating prompts that balance both short and long reasoning paths. Additionally, refining the role instructions through prompt engineering may help.
218
+ 3. **Model safety:** Occasionally, the model refuses to answer certain questions. My intuition is that Meta has implemented safeguards against topics like theft.
219
+ 4. **Training process:** I did not complete all five epochs of training. Instead, I halted training between the fourth and fifth epochs since evaluation loss had plateaued. Interestingly, when testing the best checkpoint (900) based on evaluation loss, the model showed a higher tendency to enter infinite loops. As a result, I retained the final checkpoint, which demonstrated better control over stopping conditions.
220
+
221
+
222
+ ### Checkpoints
223
+ My checkpoints are available on Hugging Face:
224
+ https://huggingface.co/keeeeenw/Llama-3.2-1B-Instruct-Open-R1-Distill-checkpoints/tree/main
225
+
226
+ Please feel free to use it for continued training or load any checkpoints for an in-depth study of how the model learns to reason.
227
+
228
  ## 🏋️‍♂️ Training Details
229
 
230
  To reprdouce the results, simply go to HuggingFace's [OpenR1](https://github.com/huggingface/open-r1) and install the package.
 
250
  per_device_train_batch_size: 4
251
  ```
252
 
253
+ ### WandDB Figures
254
+
255
+
256
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/65fd0779788669738918c128/uA_vsImDJPVMmjHNg0DoX.png)
257
+
258
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/65fd0779788669738918c128/j5wUK6APRW76J48wjtXTR.png)
259
+
260
  ## 📊 Evaluation
261
 
262
  The evaluation of this model is based on HuggingFace's instructions [OpenR1](https://github.com/huggingface/open-r1)
 
275
  --output-dir $OUTPUT_DIR
276
  ```
277
 
278
+ Results: To be added. I don't have CUDA-12.1 on the rental GPU server so I will run evaluation later.
279