From 4be70adb57f850b80771c7bb83c9075faa0ff5e7 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 11 Feb 2025 15:00:44 -0800 Subject: [PATCH] Update rl.py --- unsloth/models/rl.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/unsloth/models/rl.py b/unsloth/models/rl.py index a098c896f1..0c34f50024 100644 --- a/unsloth/models/rl.py +++ b/unsloth/models/rl.py @@ -272,8 +272,10 @@ def _patch_trl_rl_trainers(trainer_file = "grpo_trainer"): # Warn on too large or too small learning rate if " learning_rate" in call_args: learning_rate_check = \ - "if learning_rate < 1e-7: raise FloatingPointError(f'Unsloth: Your learning rate of `{learning_rate}` is too small and less than 1e-7! Consider increasing it, otherwise gradient updates will be close to 0!')\n"\ - "if learning_rate > 1: raise OverflowError(f'Unsloth: Your learning rate of `{learning_rate}` is way too larger > 1! Consider decreasing it to 1e-1, otherwise gradient updates will explode!')\n" + "if learning_rate < 1e-7: raise FloatingPointError(f'Unsloth: Your learning rate of `{learning_rate}` is too small and less than 1e-7! '"\ + "'Consider increasing it, otherwise gradient updates will be close to 0!')\n"\ + "if learning_rate > 1: raise OverflowError(f'Unsloth: Your learning rate of `{learning_rate}` is way too larger > 1! '"\ + "Consider decreasing it to 1e-1, otherwise gradient updates will explode!')\n" extra_args += learning_rate_check pass