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 Han5c2c53afee07
diff --git a/unsloth/models/rl.py b/unsloth/models/rl.pyindex bfbd0bf1037..1a06277d854 100644--- a/unsloth/models/rl.py+++ b/unsloth/models/rl.py@@ -229,6 +229,7 @@ from transformers import DataCollatorForSeq2Seq, DataCollatorForLanguageModelingfrom transformers.training_args import ParallelMode# Wrap trainer with padding to right and enable training mode+# Also patches W&B since multiple runs must use wandb.finish()import functoolsfrom types import MethodTypedef prepare_for_training_mode(f):@@ -241,6 +242,12 @@ def prepare_for_training_mode(f):# Return inference modeif hasattr(self, 'model') and hasattr(self.model, "for_inference"):self.model.for_inference()+ # Patch W&B to enable logging on future runs, otherwise it'll overwrite the first run+ try:+ import wandb+ wandb.finish()+ except:+ passreturn outputreturn wrapperpass