From 6f8711e2e6e09b0bb135c2d38bacb856bc722c93 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Sun, 22 Jun 2025 05:34:52 -0700 Subject: [PATCH] Update rl_replacements.py --- unsloth/models/rl_replacements.py | 1 + 1 file changed, 1 insertion(+) diff --git a/unsloth/models/rl_replacements.py b/unsloth/models/rl_replacements.py index f590958948..5d4fc57b77 100644 --- a/unsloth/models/rl_replacements.py +++ b/unsloth/models/rl_replacements.py @@ -263,6 +263,7 @@ def grpo_trainer__get_per_token_logps(function_name, function): # We add 1 to `logits_to_keep` because the last logits of the sequence is later excluded hidden_states = model(input_ids=input_ids, attention_mask=attention_mask, logits_to_keep=logits_to_keep + 1).logits #logits = logits[:, :-1, :] # (B, L-1, V), exclude the last logit: it corresponds to the next token pred + print("##############, input_ids", input_ids.shape) print("##############, hidden_states", hidden_states.shape) return hidden_states # input_ids = input_ids[:, -logits_to_keep:]