From 32b3d23b60a8a02f9b4644f4e73925980f128f93 Mon Sep 17 00:00:00 2001 From: Shawn Chiao Date: Thu, 6 Feb 2025 21:25:31 -0800 Subject: [PATCH 1/2] adds support for override compute path --- verl/trainer/main_ppo.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/verl/trainer/main_ppo.py b/verl/trainer/main_ppo.py index 7557aec6..ac8bd27b 100644 --- a/verl/trainer/main_ppo.py +++ b/verl/trainer/main_ppo.py @@ -22,7 +22,18 @@ @hydra.main(config_path='config', config_name='ppo_trainer', version_base=None) def main(config): - run_ppo(config) + # Get the compute_score_path from config if specified + compute_score_path = config.get('compute_score_path', None) + + # Import the custom compute_score if path is provided + compute_score = None + if compute_score_path: + module_path, function_name = compute_score_path.rsplit('.', 1) + import importlib + module = importlib.import_module(module_path) + compute_score = getattr(module, function_name) + + run_ppo(config, compute_score) def run_ppo(config, compute_score=None): From 179ac9846cd14340429739771aaa78fa3efa704f Mon Sep 17 00:00:00 2001 From: Shawn Chiao Date: Wed, 19 Feb 2025 13:18:19 -0800 Subject: [PATCH 2/2] update comment --- verl/trainer/main_ppo.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/verl/trainer/main_ppo.py b/verl/trainer/main_ppo.py index ac8bd27b..1425ce94 100644 --- a/verl/trainer/main_ppo.py +++ b/verl/trainer/main_ppo.py @@ -22,10 +22,8 @@ @hydra.main(config_path='config', config_name='ppo_trainer', version_base=None) def main(config): - # Get the compute_score_path from config if specified + # Get the compute_score_path and import custom reward function if provided compute_score_path = config.get('compute_score_path', None) - - # Import the custom compute_score if path is provided compute_score = None if compute_score_path: module_path, function_name = compute_score_path.rsplit('.', 1)