mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-19 12:58:07 +00:00
Tweaked some question templates
This commit is contained in:
parent
99b49f868f
commit
5b1e42f878
5 changed files with 17 additions and 10 deletions
|
|
@ -64,6 +64,9 @@ class BasicArithmeticDataset(ProceduralDataset):
|
|||
|
||||
def __init__(self, config: BasicArithmeticDatasetConfig):
|
||||
super().__init__(config=config, seed=config.seed, size=config.size)
|
||||
self.added_instruction = (
|
||||
"Ensure to report the answer as an integer. Please do not add commas to the integer answers reported."
|
||||
)
|
||||
|
||||
def __getitem__(self, idx: int) -> dict[str, Any]:
|
||||
"""Generate a single arithmetic task
|
||||
|
|
@ -88,7 +91,7 @@ class BasicArithmeticDataset(ProceduralDataset):
|
|||
else:
|
||||
expression, result = self._generate_simple_task(rng, num_terms, num_digits)
|
||||
|
||||
question = self._format_question(rng, expression)
|
||||
question = self._format_question(rng, expression) + self.added_instruction
|
||||
|
||||
return {
|
||||
"question": question,
|
||||
|
|
@ -224,14 +227,14 @@ class BasicArithmeticDataset(ProceduralDataset):
|
|||
|
||||
def _format_question(self, rng: Random, expression: str) -> str:
|
||||
"""Format the expression with clear answer positioning"""
|
||||
answer_instruction = "Put your final answer after '=' without additional text."
|
||||
# answer_instruction = "Put your final answer after '=' without additional text."
|
||||
|
||||
if self.config.format_style == "simple":
|
||||
return f"{answer_instruction} Calculate {expression} ="
|
||||
return f"Calculate {expression}. "
|
||||
else:
|
||||
templates = ["What is {0} =", "Solve {0}=", "Compute {0} =", "Evaluate: {0} ="]
|
||||
templates = ["What is {0}. ", "Solve {0}. ", "Compute {0}. ", "Evaluate: {0}. "]
|
||||
template = rng.choice(templates).format(expression)
|
||||
return f"{answer_instruction} {template}"
|
||||
return f"{template}"
|
||||
|
||||
|
||||
# Register the dataset
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue