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
Merge main into grpo-fix-on-pr3754
danielhanchen3240ab3391f7
diff --cc unsloth/models/rl.pyindex 1327208c46d,fd0c69bb0e6..fa95a809b22--- a/unsloth/models/rl.py+++ b/unsloth/models/rl.py@@@ -244,12 -245,14 +248,17 @@@ def prepare_for_training_mode(f)if hasattr(self, 'model') and hasattr(self.model, "for_training"):self.model.for_training()output = f(self, *args, **kwargs)- # Return inference mode+ # Restore previous mode when possibleif hasattr(self, 'model') and hasattr(self.model, "for_inference"):- self.model.for_inference()+ if _was_training is False:+ self.model.for_inference()+ elif _was_training is True and hasattr(self.model, "for_training"):+ self.model.for_training()+ # Reset gradient checkpointing buffers to free memory while staying ready for next run+ try:+ reset_unsloth_gradient_checkpointing_buffers()+ except:+ pass# Patch W&B to enable logging on future runs, otherwise it'll overwrite the first runtry:import wandb