qq8933's picture
Update README.md
4da3888 verified
---
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