Update README.md
Browse files
README.md
CHANGED
|
@@ -62,51 +62,6 @@ for idx in range(1, len(example["completions"])+1):
|
|
| 62 |
# Step 9 Predicted (score): False (0.97) Label: False
|
| 63 |
```
|
| 64 |
|
| 65 |
-
Example 1)
|
| 66 |
-
|
| 67 |
-
```python
|
| 68 |
-
from datasets import load_dataset
|
| 69 |
-
from transformers import pipeline
|
| 70 |
-
import os
|
| 71 |
-
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
|
| 72 |
-
|
| 73 |
-
model_name = "plaguss/Qwen2.5-0.5B-Math-Shepherd-PRM-0.2"
|
| 74 |
-
|
| 75 |
-
pipe = pipeline("token-classification", model=model_name, device="cuda")
|
| 76 |
-
dataset = load_dataset("trl-lib/math_shepherd")
|
| 77 |
-
example = dataset["test"][10]
|
| 78 |
-
|
| 79 |
-
sep = "\n"
|
| 80 |
-
|
| 81 |
-
print(sep.join((example["prompt"], *example["completions"])))
|
| 82 |
-
for idx in range(1, len(example["completions"])+1):
|
| 83 |
-
text = sep.join((example["prompt"], *example["completions"][0:idx])) + sep
|
| 84 |
-
output = pipe(text)
|
| 85 |
-
score = float(output[-1]["score"])
|
| 86 |
-
pred = True if output[-1]["entity"] == "LABEL_1" else False
|
| 87 |
-
print(f"Step {idx}\tPredicted (score): {pred} ({score:.2f})\tLabel: {example['labels'][idx-1]}")
|
| 88 |
-
|
| 89 |
-
# Grandma gave Bryce and Carter some raisins. Bryce received 6 more raisins than Carter, and Carter received half the number of raisins Bryce received. How many raisins did Bryce receive?
|
| 90 |
-
# Step 1: Let $b$ be the number of raisins Bryce received and $c$ be the number of raisins Carter received.
|
| 91 |
-
# Step 2: We are given that $b = c + 6$ and $c = \frac{1}{2}b$.
|
| 92 |
-
# Step 3: Substituting the second equation into the first equation, we get $b = c + 6 = \frac{1}{2}b + 6$.
|
| 93 |
-
# Step 4: Simplifying, we have $b = \frac{1}{2}b + 6$.
|
| 94 |
-
# Step 5: Subtracting $\frac{1}{2}b$ from both sides, we get $\frac{1}{2}b - b = 6$.
|
| 95 |
-
# Step 6: Simplifying further, we have $\frac{1}{2}b - 2b = 6$.
|
| 96 |
-
# Step 7: Combining like terms, we have $-\frac{1}{2}b = 6$.
|
| 97 |
-
# Step 8: Multiplying both sides by $-2$, we get $b = -12$.
|
| 98 |
-
# Step 9: Therefore, Bryce received $\boxed{-12}$ raisins.The answer is: -12
|
| 99 |
-
# Step 1 Predicted (score): True (0.99) Label: True
|
| 100 |
-
# Step 2 Predicted (score): True (0.99) Label: True
|
| 101 |
-
# Step 3 Predicted (score): True (0.94) Label: True
|
| 102 |
-
# Step 4 Predicted (score): True (0.82) Label: True
|
| 103 |
-
# Step 5 Predicted (score): True (0.58) Label: True
|
| 104 |
-
# Step 6 Predicted (score): False (0.62) Label: False
|
| 105 |
-
# Step 7 Predicted (score): False (0.77) Label: False
|
| 106 |
-
# Step 8 Predicted (score): False (0.91) Label: False
|
| 107 |
-
# Step 9 Predicted (score): False (0.97) Label: False
|
| 108 |
-
```
|
| 109 |
-
|
| 110 |
Example 2)
|
| 111 |
|
| 112 |
```python
|
|
@@ -193,16 +148,16 @@ for i, example in enumerate(examples):
|
|
| 193 |
pred = True if output[-1]["entity"] == "LABEL_1" else False
|
| 194 |
print(f"Step {idx}\tPredicted (score): {pred} ({score:.2f})\tLabel: {example['labels'][idx-1]}")
|
| 195 |
|
| 196 |
-
- Example 0:
|
| 197 |
-
Step 1 Predicted (score): True (0.90) Label: True
|
| 198 |
-
Step 2 Predicted (score): False (0.55) Label: True
|
| 199 |
-
Step 3 Predicted (score): False (0.62) Label: True
|
| 200 |
-
Step 4 Predicted (score): False (0.90) Label: True
|
| 201 |
-
- Example 1:
|
| 202 |
-
Step 1 Predicted (score): True (0.90) Label: True
|
| 203 |
-
Step 2 Predicted (score): False (0.55) Label: True
|
| 204 |
-
Step 3 Predicted (score): False (0.62) Label: True
|
| 205 |
-
Step 4 Predicted (score): False (0.96) Label: False
|
| 206 |
```
|
| 207 |
|
| 208 |
|
|
|
|
| 62 |
# Step 9 Predicted (score): False (0.97) Label: False
|
| 63 |
```
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
Example 2)
|
| 66 |
|
| 67 |
```python
|
|
|
|
| 148 |
pred = True if output[-1]["entity"] == "LABEL_1" else False
|
| 149 |
print(f"Step {idx}\tPredicted (score): {pred} ({score:.2f})\tLabel: {example['labels'][idx-1]}")
|
| 150 |
|
| 151 |
+
# - Example 0:
|
| 152 |
+
# Step 1 Predicted (score): True (0.90) Label: True
|
| 153 |
+
# Step 2 Predicted (score): False (0.55) Label: True
|
| 154 |
+
# Step 3 Predicted (score): False (0.62) Label: True
|
| 155 |
+
# Step 4 Predicted (score): False (0.90) Label: True
|
| 156 |
+
# - Example 1:
|
| 157 |
+
# Step 1 Predicted (score): True (0.90) Label: True
|
| 158 |
+
# Step 2 Predicted (score): False (0.55) Label: True
|
| 159 |
+
# Step 3 Predicted (score): False (0.62) Label: True
|
| 160 |
+
# Step 4 Predicted (score): False (0.96) Label: False
|
| 161 |
```
|
| 162 |
|
| 163 |
|