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
Update rl.py
Daniel Hanaebeeb4901a6
diff --git a/unsloth/models/rl.py b/unsloth/models/rl.pyindex 72b568790dd..2431e5a70f5 100644--- a/unsloth/models/rl.py+++ b/unsloth/models/rl.py@@ -39,15 +39,13 @@ def PatchRL(FastLanguageModel):@contextmanagerdef unsloth_unwrap_model_for_generation(model, accelerator):# Must use for_inference to allow inference in Unsloth- with torch.inference_mode():- with unwrap_model_for_generation(model, accelerator) as unwrapped_model:- FastLanguageModel.for_inference(unwrapped_model)- try:- yield unwrapped_model- finally:- # Finally return back training- FastLanguageModel.for_training(model)- pass+ with unwrap_model_for_generation(model, accelerator) as unwrapped_model:+ FastLanguageModel.for_inference(unwrapped_model)+ try:+ yield unwrapped_model.eval()+ finally:+ # Finally return back training+ FastLanguageModel.for_training(model)passpasspass