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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Fix for grpo_compute_loss_slow (#2702)
simpissa8a202d6175ed
diff --git a/unsloth/models/rl_replacements.py b/unsloth/models/rl_replacements.pyindex 1fe63bb44c6..96e256b6536 100644--- a/unsloth/models/rl_replacements.py+++ b/unsloth/models/rl_replacements.py@@ -337,6 +337,8 @@ def grpo_trainer_compute_loss(function_name, function):old_hidden_states = Noneinput_ids = input_ids[:, -logits_to_keep:]if per_token_logps is not None:+ ref_per_token_logps = ref_per_token_logps[:, :-1, :]+ per_token_logps = per_token_logps[:, :-1, :]loss, completion_length, mean_kl = grpo_compute_loss_slow(ref_per_token_logps, per_token_logps, old_hidden_states, input_ids, completion_mask, self.beta, advantages,loss_type = self.args.loss_type,