Model Card for Mistral-7B-v0.1-Math-Shepherd-PRM-0.1
This model is a fine-tuned version of mistralai/Mistral-7B-v0.1 on the trl-lib/math_shepherd dataset. It has been trained using TRL.
Quick start
Example 1
from datasets import load_dataset
from transformers import pipeline
pipe = pipeline("token-classification", model="plaguss/Mistral-7B-v0.1-Math-Shepherd-PRM-0.1")
dataset = load_dataset("trl-lib/math_shepherd")
example = dataset["test"][10]
print("\n".join((example["prompt"], *example["completions"])))
for idx in range(1, len(example["completions"])+1):
text = "\n".join((example["prompt"], *example["completions"][0:idx])) + "\n"
score = float(pipe(text)[-1]["score"])
print(f"Step {idx}\tScore: {score:.4f}\tLabel: {example['labels'][idx-1]}")
# Asking to truncate to max_length but no maximum length is provided and the model has no predefined maximum length. Default to no truncation.
# Step 1 Score: 1.00 Label: True
# Step 2 Score: 1.00 Label: True
# Step 3 Score: 1.00 Label: True
# Step 4 Score: 0.96 Label: True
# Step 5 Score: 0.95 Label: True
# Step 6 Score: 0.88 Label: False
# Step 7 Score: 0.73 Label: False
# Step 8 Score: 0.86 Label: False
# Step 9 Score: 0.96 Label: False
Original case from the Math-Shepherd paper
from datasets import load_dataset
from transformers import pipeline
pipe = pipeline("token-classification", model="plaguss/Mistral-7B-v0.1-Math-Shepherd-PRM-0.1", device="cuda")
examples = [
{
"prompt": "Janet\u2019s ducks lay 16 eggs per day. She eats three for breakfast every morning and bakes muffins for her friends every day with four. She sells the remainder at the farmers' market daily for $2 per fresh duck egg. How much in dollars does she make every day at the farmers' market?",
"completions": [
"Step 1: Janet's ducks lay 16 eggs per day.",
'Step 2: She eats three for breakfast every morning, so she has 16 - 3 = 13 eggs left.',
'Step 3: She bakes muffins for her friends every day with four eggs, so she has 13 - 4 = 9 eggs left.',
"Step 4: She sells the remainder at the farmers' market daily for $2 per fresh duck egg, so she makes 9 * $2 = $18 every day at the farmers' market. The answer is: 18"
],
"labels": [True, True, True, True]
},
{
"prompt": "Janet\u2019s ducks lay 16 eggs per day. She eats three for breakfast every morning and bakes muffins for her friends every day with four. She sells the remainder at the farmers' market daily for $2 per fresh duck egg. How much in dollars does she make every day at the farmers' market?",
"completions": [
"Step 1: Janet's ducks lay 16 eggs per day.",
'Step 2: She eats three for breakfast every morning, so she has 16 - 3 = 13 eggs left.',
'Step 3: She bakes muffins for her friends every day with four eggs, so she has 13 - 4 = 9 eggs left.',
"Step 4: She sells the remainder at the farmers' market daily for $2 per fresh duck egg, so she makes 9 * $2 = $18 every day at the farmers' market. The answer is: 17"
],
"labels": [True, True, True, False]
},
]
for i, example in enumerate(examples):
print(f"- Example {i}:")
for idx in range(1, len(example["completions"])+1):
text = "\n".join((example["prompt"], *example["completions"][0:idx])) + "\n"
score = float(pipe(text)[-1]["score"])
print(f"Step {idx}\tScore: {score:.2f}\tLabel: {example['labels'][idx-1]}")
# - Example 0:
# Step 1 Score: 1.00 Label: True
# Step 2 Score: 1.00 Label: True
# Step 3 Score: 1.00 Label: True
# Step 4 Score: 1.00 Label: True
# - Example 1:
# Step 1 Score: 1.00 Label: True
# Step 2 Score: 1.00 Label: True
# Step 3 Score: 1.00 Label: True
# Step 4 Score: 0.98 Label: False
Training procedure
This model was trained with Stepwise Reward.
Framework versions
- TRL: 0.13.0.dev0
- Transformers: 4.46.0.dev0
- Pytorch: 2.4.1
- Datasets: 3.0.1
- Tokenizers: 0.20.1
Citations
Cite Stepwise Reward as:
@article{uesato2022solving,
title = {Solving Math Word Problems With Process- and Outcome-Based Feedback},
author = {Uesato, Jonathan and Kushman, Nate and Kumar, Ramana and Song, Francis and Siegel, Noah and Wang, Lisa and Creswell, Antonia and Irving, Geoffrey and Higgins, Irina},
year = 2022,
journal = {arXiv preprint arXiv:2211.14275}
}
Cite TRL as:
@misc{vonwerra2022trl,
title = {{TRL: Transformer Reinforcement Learning}},
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},
year = 2020,
journal = {GitHub repository},
publisher = {GitHub},
howpublished = {\url{https://github.com/huggingface/trl}}
}
- Downloads last month
- 24
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.
Model tree for plaguss/Mistral-7B-v0.1-Math-Shepherd-PRM-0.1
Base model
mistralai/Mistral-7B-v0.1