From 6ea100d658052602bef791db2b14aba7f99fc6fa Mon Sep 17 00:00:00 2001 From: YeonwooSung Date: Sun, 16 Feb 2025 18:07:20 +0900 Subject: [PATCH] fix: Fix up regex str for better filtering --- LLMs/training/train_grpo.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LLMs/training/train_grpo.py b/LLMs/training/train_grpo.py index 0d844e0..819d796 100644 --- a/LLMs/training/train_grpo.py +++ b/LLMs/training/train_grpo.py @@ -77,7 +77,8 @@ def strict_format_reward_func(completions, **kwargs) -> list[float]: def soft_format_reward_func(completions, **kwargs) -> list[float]: """Reward function that checks if the completion has a specific format.""" - pattern = r".*?\s*.*?" + #pattern = r".*?\s*.*?" + pattern = r"[\s\S]*\s*.*?" responses = [completion[0]["content"] for completion in completions] matches = [re.match(pattern, r, flags=re.DOTALL) for r in responses] return [0.5 if match else 0.0 for match in matches]