Update rl_replacements.py

This commit is contained in:
Daniel Han 2025-02-20 08:31:37 -08:00
commit e47340558e

View file

@ -164,11 +164,11 @@ RL_FUNCTIONS["grpo_trainer"].append(grpo_trainer__prepare_inputs)
# Remove _move_model_to_vllm
def grpo_trainer__move_model_to_vllm(function_name, function):
if function_name != "_move_model_to_vllm": return function
def _move_model_to_vllm(self, *args, **kwargs): return None
print(function)
# .*? matches first match. .+? matches final match.
replacement = "def _move_model_to_vllm(self, *args, **kwargs): return None\n"
return " "*function.find("def") + replacement
function = inspect.getsource(_move_model_to_vllm)
return function
pass
RL_FUNCTIONS["grpo_trainer"].append(grpo_trainer__move_model_to_vllm)