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
RL metrics
Daniel Han093cd0cde3e5
diff --git a/unsloth/models/dpo.py b/unsloth/models/dpo.pyindex 51f1c9a63a7..9c12abb98f3 100644--- a/unsloth/models/dpo.py+++ b/unsloth/models/dpo.py@@ -17,8 +17,8 @@ __all__ = ["PatchKTOTrainer",]-from .rl import PatchRLStatistics+from .rl import PatchFastRL-def PatchDPOTrainer(): PatchRLStatistics("DPO")+def PatchDPOTrainer(): PatchFastRL("DPO")-def PatchKTOTrainer(): PatchRLStatistics("KTO")+def PatchKTOTrainer(): PatchFastRL("KTO")diff --git a/unsloth/models/rl.py b/unsloth/models/rl.pyindex 02bc10c6feb..40d68f6a742 100644--- a/unsloth/models/rl.py+++ b/unsloth/models/rl.py@@ -13,8 +13,7 @@# limitations under the License.__all__ = [- "PatchRL",- "PatchRLStatistics",+ "PatchFastRL",]import torch@@ -202,6 +201,9 @@ def get_trl_metrics():left_prefix = 'prefix = "eval_" if train_eval == "eval" else ""' in fileif left_prefix: metrics += metrics_f+ # Remove all eval_ things+ metrics = [x for x in metrics if not x.startswith("eval_")]+all_metrics[trainer[:trainer.find("_")].upper()] = metricspassreturn all_metrics@@ -219,3 +221,9 @@ def PatchRLStatistics(algorithm = "GRPO"):pass_PatchRLStatistics(all_metrics[algorithm], algorithm)pass+++def PatchFastRL(algorithm = "GRPO", FastLanguageModel = None):+ if FastLanguageModel is not None: PatchRL(FastLanguageModel)+ PatchRLStatistics(algorithm)+pass