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_replacements.py

Daniel Hanfe483b621036
diff --git a/unsloth/models/rl_replacements.py b/unsloth/models/rl_replacements.py
index 86cc2fb14fd..3d97b90df9c 100644
--- a/unsloth/models/rl_replacements.py
+++ b/unsloth/models/rl_replacements.py
@@ -233,7 +233,7 @@ def grpo_trainer_compute_loss(function_name, function):
# loss = ((per_token_loss * completion_mask).sum(dim=1) / completion_mask.sum(dim=1)).mean()
input_ids = input_ids[:, -logits_to_keep:]
loss, completion_length, mean_kl = grpo_compute_loss(
- ref_per_token_logps, per_token_logps, input_ids, completion_mask, self.beta, advantages,
+ ref_per_token_logps, per_token_logps, input_ids, completion_mask, self.beta, advantages, bsz,
)
accumulated_loss, accumulated_completion_length, accumulated_mean_kl = grpo_accumulated_loss(
self, input_ids, logits_to_keep, completion_mask, advantages, n_chunks = 1,