From cedb6c15d95dcca012799a2550c195744ef94fd5 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Thu, 13 Feb 2025 04:40:42 -0800 Subject: [PATCH] Update rl_replacements.py --- unsloth/models/rl_replacements.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unsloth/models/rl_replacements.py b/unsloth/models/rl_replacements.py index 5da57c44bf..4d7a4dbe09 100644 --- a/unsloth/models/rl_replacements.py +++ b/unsloth/models/rl_replacements.py @@ -116,6 +116,8 @@ def sft_trainer_compute_loss(function_name, function): function = inspect.getsource(_sft_trainer_compute_loss) function = function.replace("def _sft_trainer_compute_loss", "def compute_loss") + function = function.split("\n") + function = "\n".join(" "*4+x for x in function) return function pass RL_FUNCTIONS["sft_trainer"].append(sft_trainer_compute_loss)