Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Update rl.py

Daniel Han965dee5f5edd
diff --git a/unsloth/models/rl.py b/unsloth/models/rl.py
index d70a83f71dc..fe1587f56bd 100644
--- a/unsloth/models/rl.py
+++ b/unsloth/models/rl.py
@@ -388,6 +388,11 @@ def _patch_trl_rl_trainers(trainer_file = "grpo_trainer"):
f"trl.trainer.{trainer_file}",
imports,
)
+
+ # Patch over modules
+ exec(f"trl.{RLTrainer_name} = module.Unsloth{RLTrainer_name}", locals(), globals())
+ exec(f"trl.trainer.{RLTrainer_name} = module.Unsloth{RLTrainer_name}", locals(), globals())
+ exec(f"trl.trainer.{trainer_file}.{RLTrainer_name} = module.Unsloth{RLTrainer_name}", locals(), globals())
return module
pass