From 74c59ef0f6dbfb43c30426def9bfc1b3a70713d1 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Thu, 6 Feb 2025 01:50:22 -0800 Subject: [PATCH] Update rl.py --- unsloth/models/rl.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unsloth/models/rl.py b/unsloth/models/rl.py index c7d3ab2c20..e8d9c19a54 100644 --- a/unsloth/models/rl.py +++ b/unsloth/models/rl.py @@ -256,6 +256,7 @@ pass def _patch_trl_rl_trainers(trainer_file = "grpo_trainer"): # Patch for vLLM and Unsloth PEFT + import trl import trl.trainer trainer = eval(f"trl.trainer.{trainer_file}") @@ -388,6 +389,7 @@ def _patch_trl_rl_trainers(trainer_file = "grpo_trainer"): exec(RLTrainer_source, imported_functions, globals()) exec(f"trl.trainer.{trainer_file}.{RLTrainer_name} = Unsloth{RLTrainer_name}", locals(), globals()) exec(f"trl.trainer.{RLTrainer_name} = Unsloth{RLTrainer_name}", locals(), globals()) + exec(f"trl.{RLTrainer_name} = Unsloth{RLTrainer_name}", locals(), globals()) pass