File size: 19,475 Bytes
6e2ada0 93f1b6c 6e2ada0 7cbef74 6e2ada0 15b4514 6e2ada0 93f1b6c 48fe3f4 93f1b6c 6e2ada0 106cbfb 6e2ada0 93f1b6c 6e2ada0 7cdfc75 93f1b6c 6e2ada0 93f1b6c 6e2ada0 4c6b915 4da3888 4c6b915 ab1551f 93f1b6c 89c4183 93f1b6c 6e2ada0 839bc05 f090e6a 839bc05 f407f9c 839bc05 03524cb 15b4514 03524cb |
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 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
---
library_name: transformers
license: other
base_model: SimpleBerry/LLaMA-O1-Base-1127
tags:
- llama-factory
- full
- generated_from_trainer
model-index:
- name: SimpleBerry/LLaMA-O1-Supervised-1129
results: []
---
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->
# SimpleBerry/LLaMA-O1-Supervised-1129
This model is a fine-tuned version of [SimpleBerry/LLaMA-O1-Base-1127](https://huggingface.co/SimpleBerry/LLaMA-O1-Base-1127) on the [SimpleBerry/OpenLongCoT-SFT](https://huggingface.co/datasets/SimpleBerry/OpenLongCoT-SFT) dataset.
# Inference
```Python
import json
import datasets
import torch
import random
import numpy as np
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("SimpleBerry/LLaMA-O1-Supervised-1129")
model = AutoModelForCausalLM.from_pretrained("SimpleBerry/LLaMA-O1-Supervised-1129",device_map='auto')
template = "<start_of_father_id>-1<end_of_father_id><start_of_local_id>0<end_of_local_id><start_of_thought><problem>{content}<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<start_of_father_id>0<end_of_father_id><start_of_local_id>1<end_of_local_id><start_of_thought><expansion>"
def llama_o1_template(query):
text = template.format(content=query)
return text
def batch_predict(input_texts):
input_texts = [input_text.replace('<|end_of_text|>','') for input_text in input_texts]
inputs = tokenizer(input_texts, return_tensors="pt").to(model.device)
responses = model.generate(**inputs, max_new_tokens=1024)
response_texts = tokenizer.batch_decode(responses, skip_special_tokens=False)
# assitant_responses = [item[len(input_texts[i]):] for i,item in enumerate(response_texts)]
assitant_responses = [item for i,item in enumerate(response_texts)]
return assitant_responses
def format_response(response):
response = response.replace('<start_of_father_id>','')
response = response.replace('<end_of_father_id><start_of_local_id>','π')
response = response.replace('<end_of_local_id><start_of_thought>',', ')
response = response.replace('<end_of_thought><start_of_rating>','')
response = response.replace('<end_of_rating>','')
response = response.replace('<positive_rating>','π')
response = response.replace('<negative_rating>','π')
return response
i = 'If Diana needs to bike 10 miles to reach home and she can bike at a speed of 3 mph for two hours before getting tired, and then at a speed of 1 mph until she reaches home, how long will it take her to get home?'
input_texts = [llama_o1_template(i)]
assitant_responses = batch_predict(input_texts)
# assitant_responses = [format_response(response) for response in assitant_responses]
print(assitant_responses)
```
Or GGUF for CPU only devices: https://huggingface.co/Lyte/LLaMA-O1-Supervised-1129-Q4_K_M-GGUF
## Example
```
If Diana needs to bike 10 miles to reach home and she can bike at a speed of 3 mph for two hours before getting tired, and then at a speed of 1 mph until she reaches home, how long will it take her to get home?
```
### Output
```python
<|begin_of_text|><start_of_father_id>-1<end_of_father_id><start_of_local_id>0<end_of_local_id><start_of_thought><problem>If Diana needs to bike 10 miles to reach home and she can bike at a speed of 3 mph for two hours before getting tired, and then at a speed of 1 mph until she reaches home, how long will it take her to get home?<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<start_of_father_id>0<end_of_father_id><start_of_local_id>1<end_of_local_id><start_of_thought><expansion>Let's start by understanding the problem. Diana needs to bike a total of 10 miles, and we know her biking speeds at different stages. We will break down the problem into smaller parts: first, calculate the distance she can cover at her initial speed, then calculate the time taken at her slower speed to reach home.<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<start_of_father_id>1<end_of_father_id><start_of_local_id>2<end_of_local_id><start_of_thought><sub_problem>First, we need to determine how far Diana can bike at her initial speed of 3 mph for 2 hours. This will help us understand how much distance she has covered before getting tired.<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<start_of_father_id>2<end_of_father_id><start_of_local_id>3<end_of_local_id><start_of_thought><expansion>To find the distance covered at 3 mph for 2 hours, we use the formula: Distance = Speed Γ Time. Therefore, Distance = 3 mph Γ 2 hours = 6 miles.<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<start_of_father_id>2<end_of_father_id><start_of_local_id>4<end_of_local_id><start_of_thought><sub_conclusion>Diana can cover 6 miles in the first 2 hours.<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<start_of_father_id>1<end_of_father_id><start_of_local_id>5<end_of_local_id><start_of_thought><sub_problem>Now we need to determine how far Diana has left to bike after the first 2 hours. This will help us calculate the remaining time she needs to cover the remaining distance.<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<start_of_father_id>5<end_of_father_id><start_of_local_id>6<end_of_local_id><start_of_thought><expansion>Diana has 10 miles total and has already biked 6 miles. Thus, the remaining distance is: 10 miles - 6 miles = 4 miles.<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<start_of_father_id>5<end_of_father_id><start_of_local_id>7<end_of_local_id><start_of_thought><sub_conclusion>Diana has 4 miles left to bike.<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<start_of_father_id>1<end_of_father_id><start_of_local_id>8<end_of_local_id><start_of_thought><sub_problem>Next, we need to calculate how long it will take Diana to bike the remaining 4 miles at her slower speed of 1 mph.<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<start_of_father_id>8<end_of_father_id><start_of_local_id>9<end_of_local_id><start_of_thought><expansion>To find the time taken to cover the remaining distance at 1 mph, we use the formula: Time = Distance / Speed. Therefore, Time = 4 miles / 1 mph = 4 hours.<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<start_of_father_id>8<end_of_father_id><start_of_local_id>10<end_of_local_id><start_of_thought><sub_conclusion>Diana will take 4 hours to bike the remaining 4 miles at her slower speed.<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<start_of_father_id>1<end_of_father_id><start_of_local_id>11<end_of_local_id><start_of_thought><expansion>Now, we combine the time taken in both stages: 2 hours (initial speed) + 4 hours (slower speed) = 6 hours.<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<start_of_father_id>1<end_of_father_id><start_of_local_id>12<end_of_local_id><start_of_thought><conclusion>The total time it will take Diana to reach home is 6 hours.<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<start_of_father_id>12<end_of_father_id><start_of_local_id>13<end_of_local_id><start_of_thought><critic>Let's review the calculations to ensure accuracy. The distance covered at the initial speed and the time taken at the slower speed seem correct. The final addition of the times also checks out.<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<start_of_father_id>12<end_of_father_id><start_of_local_id>14<end_of_local_id><start_of_thought><refine>To enhance clarity, we can rephrase the conclusion to explicitly state the total biking time and the distance covered at each speed.<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<start_of_father_id>14<end_of_father_id><start_of_local_id>15<end_of_local_id><start_of_thought><conclusion>In conclusion, Diana will take a total of 6 hours to bike 10 miles, covering 6 miles in the first 2 hours at a speed of 3 mph and the remaining 4 miles at a speed of 1 mph, which takes an additional 4 hours.<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<start_of_father_id>15<end_of_father_id><start_of_local_id>16<end_of_local_id><start_of_thought><conclusion>\\boxed{6}<end_of_thought><start_of_rating><positive_rating><end_of_rating>\n<|eot_id|>
```
### Golden Chain of Thought
**Problem:**
If Diana needs to bike 10 miles to reach home and she can bike at a speed of 3 mph for two hours before getting tired, and then at a speed of 1 mph until she reaches home, how long will it take her to get home?
---
**Step 1: Calculate the distance covered at her initial speed.**
Diana bikes at 3 mph for 2 hours.
Using the formula:
$$
\text{Distance} = \text{Speed} \times \text{Time} = 3 \, \text{mph} \times 2 \, \text{hours} = 6 \, \text{miles}
$$
**Conclusion:** Diana covers 6 miles in the first 2 hours.
---
**Step 2: Determine the remaining distance to bike.**
Diana has 10 miles to cover in total.
After biking 6 miles, the remaining distance is:
$$
\text{Remaining distance} = 10 \, \text{miles} - 6 \, \text{miles} = 4 \, \text{miles}
$$
**Conclusion:** Diana has 4 miles left to bike.
---
**Step 3: Calculate the time to bike the remaining 4 miles.**
Diana bikes at 1 mph for the remaining distance.
Using the formula:
$$
\text{Time} = \frac{\text{Distance}}{\text{Speed}} = \frac{4 \, \text{miles}}{1 \, \text{mph}} = 4 \, \text{hours}
$$
**Conclusion:** It will take Diana 4 hours to bike the remaining 4 miles.
---
**Step 4: Calculate the total time to bike home.**
The total time is the sum of the time spent biking at both speeds:
$$
\text{Total time} = 2 \, \text{hours} + 4 \, \text{hours} = 6 \, \text{hours}
$$
**Conclusion:** The total time for Diana to reach home is 6 hours.
---
**Final Conclusion:**
Diana will take **6 hours** to bike 10 miles, covering 6 miles in the first 2 hours at a speed of 3 mph, and the remaining 4 miles at a speed of 1 mph, which takes an additional 4 hours.
$$
\boxed{6}
$$
### Marked Language of Long Chain of Thought
```xml
<|begin_of_text|>
<start_of_father_id>-1</start_of_father_id>
<start_of_local_id>0</start_of_local_id>
<start_of_thought>
<problem>If Diana needs to bike 10 miles to reach home and she can bike at a speed of 3 mph for two hours before getting tired, and then at a speed of 1 mph until she reaches home, how long will it take her to get home?</problem>
</start_of_thought>
<start_of_rating><positive_rating></start_of_rating>
<start_of_father_id>0</start_of_father_id>
<start_of_local_id>1</start_of_local_id>
<start_of_thought>
<expansion>Let's start by understanding the problem. Diana needs to bike a total of 10 miles, and we know her biking speeds at different stages. We will break down the problem into smaller parts: first, calculate the distance she can cover at her initial speed, then calculate the time taken at her slower speed to reach home.</expansion>
</start_of_thought>
<start_of_rating><positive_rating></start_of_rating>
<start_of_father_id>1</start_of_father_id>
<start_of_local_id>2</start_of_local_id>
<start_of_thought>
<sub_problem>First, we need to determine how far Diana can bike at her initial speed of 3 mph for 2 hours. This will help us understand how much distance she has covered before getting tired.</sub_problem>
</start_of_thought>
<start_of_rating><positive_rating></start_of_rating>
<start_of_father_id>2</start_of_father_id>
<start_of_local_id>3</start_of_local_id>
<start_of_thought>
<expansion>To find the distance covered at 3 mph for 2 hours, we use the formula: Distance = Speed Γ Time. Therefore, Distance = 3 mph Γ 2 hours = 6 miles.</expansion>
</start_of_thought>
<start_of_rating><positive_rating></start_of_rating>
<start_of_father_id>2</start_of_father_id>
<start_of_local_id>4</start_of_local_id>
<start_of_thought>
<sub_conclusion>Diana can cover 6 miles in the first 2 hours.</sub_conclusion>
</start_of_thought>
<start_of_rating><positive_rating></start_of_rating>
<start_of_father_id>1</start_of_father_id>
<start_of_local_id>5</start_of_local_id>
<start_of_thought>
<sub_problem>Now we need to determine how far Diana has left to bike after the first 2 hours. This will help us calculate the remaining time she needs to cover the remaining distance.</sub_problem>
</start_of_thought>
<start_of_rating><positive_rating></start_of_rating>
<start_of_father_id>5</start_of_father_id>
<start_of_local_id>6</start_of_local_id>
<start_of_thought>
<expansion>Diana has 10 miles total and has already biked 6 miles. Thus, the remaining distance is: 10 miles - 6 miles = 4 miles.</expansion>
</start_of_thought>
<start_of_rating><positive_rating></start_of_rating>
<start_of_father_id>5</start_of_father_id>
<start_of_local_id>7</start_of_local_id>
<start_of_thought>
<sub_conclusion>Diana has 4 miles left to bike.</sub_conclusion>
</start_of_thought>
<start_of_rating><positive_rating></start_of_rating>
<start_of_father_id>1</start_of_father_id>
<start_of_local_id>8</start_of_local_id>
<start_of_thought>
<sub_problem>Next, we need to calculate how long it will take Diana to bike the remaining 4 miles at her slower speed of 1 mph.</sub_problem>
</start_of_thought>
<start_of_rating><positive_rating></start_of_rating>
<start_of_father_id>8</start_of_father_id>
<start_of_local_id>9</start_of_local_id>
<start_of_thought>
<expansion>To find the time taken to cover the remaining distance at 1 mph, we use the formula: Time = Distance / Speed. Therefore, Time = 4 miles / 1 mph = 4 hours.</expansion>
</start_of_thought>
<start_of_rating><positive_rating></start_of_rating>
<start_of_father_id>8</start_of_father_id>
<start_of_local_id>10</start_of_local_id>
<start_of_thought>
<sub_conclusion>Diana will take 4 hours to bike the remaining 4 miles at her slower speed.</sub_conclusion>
</start_of_thought>
<start_of_rating><positive_rating></start_of_rating>
<start_of_father_id>1</start_of_father_id>
<start_of_local_id>11</start_of_local_id>
<start_of_thought>
<expansion>Now, we combine the time taken in both stages: 2 hours (initial speed) + 4 hours (slower speed) = 6 hours.</expansion>
</start_of_thought>
<start_of_rating><positive_rating></start_of_rating>
<start_of_father_id>1</start_of_father_id>
<start_of_local_id>12</start_of_local_id>
<start_of_thought>
<conclusion>The total time it will take Diana to reach home is 6 hours.</conclusion>
</start_of_thought>
<start_of_rating><positive_rating></start_of_rating>
<start_of_father_id>12</start_of_father_id>
<start_of_local_id>13</start_of_local_id>
<start_of_thought>
<critic>Let's review the calculations to ensure accuracy. The distance covered at the initial speed and the time taken at the slower speed seem correct. The final addition of the times also checks out.</critic>
</start_of_thought>
<start_of_rating><positive_rating></start_of_rating>
<start_of_father_id>12</start_of_father_id>
<start_of_local_id>14</start_of_local_id>
<start_of_thought>
<refine>To enhance clarity, we can rephrase the conclusion to explicitly state the total biking time and the distance covered at each speed.</refine>
</start_of_thought>
<start_of_rating><positive_rating></start_of_rating>
<start_of_father_id>14</start_of_father_id>
<start_of_local_id>15</start_of_local_id>
<start_of_thought>
<conclusion>In conclusion, Diana will take a total of 6 hours to bike 10 miles, covering 6 miles in the first 2 hours at a speed of 3 mph and the remaining 4 miles at a speed of 1 mph, which takes an additional 4 hours.</conclusion>
</start_of_thought>
<start_of_rating><positive_rating></start_of_rating>
<start_of_father_id>15</start_of_father_id>
<start_of_local_id>16</start_of_local_id>
<start_of_thought>
<conclusion>\boxed{6}</conclusion>
</start_of_thought>
<start_of_rating><positive_rating></start_of_rating>
<|end_of_text|>
```
### Tree View
```bash
.
βββ problem
β βββ If Diana needs to bike 10 miles to reach home and she can bike at a speed of 3 mph for two hours before getting tired, and then at a speed of 1 mph until she reaches home, how long will it take her to get home?
βββ expansion
β βββ Let's start by understanding the problem. Diana needs to bike a total of 10 miles, and we know her biking speeds at different stages. We will break down the problem into smaller parts: first, calculate the distance she can cover at her initial speed, then calculate the time taken at her slower speed to reach home.
βββ sub_problem
β βββ First, we need to determine how far Diana can bike at her initial speed of 3 mph for 2 hours. This will help us understand how much distance she has covered before getting tired.
β βββ expansion
β βββ To find the distance covered at 3 mph for 2 hours, we use the formula: Distance = Speed Γ Time. Therefore, Distance = 3 mph Γ 2 hours = 6 miles.
β βββ sub_conclusion
β βββ Diana can cover 6 miles in the first 2 hours.
βββ sub_problem
β βββ Now we need to determine how far Diana has left to bike after the first 2 hours. This will help us calculate the remaining time she needs to cover the remaining distance.
β βββ expansion
β βββ Diana has 10 miles total and has already biked 6 miles. Thus, the remaining distance is: 10 miles - 6 miles = 4 miles.
β βββ sub_conclusion
β βββ Diana has 4 miles left to bike.
βββ sub_problem
β βββ Next, we need to calculate how long it will take Diana to bike the remaining 4 miles at her slower speed of 1 mph.
β βββ expansion
β βββ To find the time taken to cover the remaining distance at 1 mph, we use the formula: Time = Distance / Speed. Therefore, Time = 4 miles / 1 mph = 4 hours.
β βββ sub_conclusion
β βββ Diana will take 4 hours to bike the remaining 4 miles at her slower speed.
βββ expansion
β βββ Now, we combine the time taken in both stages: 2 hours (initial speed) + 4 hours (slower speed) = 6 hours.
βββ conclusion
β βββ The total time it will take Diana to reach home is 6 hours.
βββ critic
β βββ Let's review the calculations to ensure accuracy. The distance covered at the initial speed and the time taken at the slower speed seem correct. The final addition of the times also checks out.
βββ refine
β βββ To enhance clarity, we can rephrase the conclusion to explicitly state the total biking time and the distance covered at each speed.
βββ conclusion
β βββ In conclusion, Diana will take a total of 6 hours to bike 10 miles, covering 6 miles in the first 2 hours at a speed of 3 mph and the remaining 4 miles at a speed of 1 mph, which takes an additional 4 hours.
βββ conclusion
βββ \boxed{6}
```
## Citations
Our ongoing related researches:
https://huggingface.co/papers/2406.07394
https://huggingface.co/papers/2410.02884
https://huggingface.co/papers/2411.18203
## Codes
https://github.com/SimpleBerry/LLaMA-O1
## License
MIT
|