Skip to content

Commit e80a806

Browse files
committed
remove verification
1 parent 86ad161 commit e80a806

File tree

2 files changed

+12
-429
lines changed

2 files changed

+12
-429
lines changed

src/genesys/generate.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from datasets import load_dataset
55
from tqdm import tqdm
66
from transformers import AutoTokenizer
7-
from genesys.utils import repeat_elements, save_batch_results, verify_math_sample
7+
import json
88

99
SYSTEM_PROMPT = "Solve the following math problem efficiently and clearly. Think carefully and step by step about your response and reason before providing a final response. Conclude your response with: \n\nTherefore, the final answer is: $\\boxed{answer}$. I hope it is correct.\n\nWhere [answer] is just the final number or expression that solves the problem. If the question is a multiple choice question, [answer] should be the letter indicating your correct response (e.g. \\text{A} or \\text{B})."
1010

@@ -19,6 +19,17 @@ class Config(BaseConfig):
1919
max_samples: int | None = None
2020

2121

22+
def repeat_elements(lst, n):
23+
return [item for item in lst for _ in range(n)]
24+
25+
26+
def save_batch_results(batch_results, results_file):
27+
with open(results_file, "a") as f:
28+
for result in batch_results:
29+
json.dump(result, f)
30+
f.write("\n")
31+
32+
2233
def main(config: Config):
2334
llm = sgl.Engine(model_path=config.name_model, tp_size=config.num_gpus)
2435
tokenizer = AutoTokenizer.from_pretrained(config.name_model)
@@ -56,7 +67,6 @@ def main(config: Config):
5667
result["response"] = out["text"]
5768
result["problem_id"] = int(batch_ids[j])
5869
result["ground_truth"] = batch_ground_truths[j]
59-
result["correct"] = verify_math_sample(out["text"], batch_ground_truths[j])
6070

6171
all_results.append(result)
6272

0 commit comments

Comments
 (0)