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 Han2a674861095c
diff --git a/unsloth/models/rl_replacements.py b/unsloth/models/rl_replacements.py
index 585545be151..7de04b06059 100644
--- a/unsloth/models/rl_replacements.py
+++ b/unsloth/models/rl_replacements.py
@@ -324,7 +324,8 @@ def grpo_trainer_compute_loss(function_name, function):
print("logits_to_keep Unsloth 320", logits_to_keep)
per_token_logps = self._get_per_token_logps(model, input_ids, attention_mask, logits_to_keep)
- print("per_token_logps Unsloth 320", per_token_logps.shape)
+ if per_token_logps is not None:
+ print("per_token_logps Unsloth 320", per_token_logps.shape)
# Compute the KL divergence between the model and the reference model
# _prepare_inputs doesn't return reference log probs anymore. We need to calculate it ourselves.