SimpleBerry/LLaMA-O1-Supervised-1129
This model is a fine-tuned version of SimpleBerry/LLaMA-O1-Base-1127 on the SimpleBerry/OpenLongCoT-SFT dataset.
Inference
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
<|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:
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:
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:
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:
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.
Marked Language of Long Chain of Thought
<|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
.
βββ 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
- Downloads last month
- 714
Model tree for SimpleBerry/LLaMA-O1-Supervised-1129
Base model
meta-llama/Llama-3.1-8B