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
CE Loss
Daniel Han37b160d72475
diff --git a/unsloth/kernels/__init__.py b/unsloth/kernels/__init__.pyindex 78e70a65b50..3b31f499992 100644--- a/unsloth/kernels/__init__.py+++ b/unsloth/kernels/__init__.py@@ -15,6 +15,7 @@from .cross_entropy_loss import (fast_cross_entropy_loss,post_patch_loss_function,+ patch_loss_functions,)from .rms_layernorm import (fast_rms_layernorm,diff --git a/unsloth/kernels/cross_entropy_loss.py b/unsloth/kernels/cross_entropy_loss.pyindex 92e64bfa9ba..41bce690e1d 100644--- a/unsloth/kernels/cross_entropy_loss.py+++ b/unsloth/kernels/cross_entropy_loss.py@@ -20,7 +20,7 @@ from transformers.models.llama.modeling_llama import loggerfrom packaging.version import Versionfrom unsloth_zoo.loss_utils import (- patch_loss_functions,+ patch_loss_functions as _patch_loss_functions,post_patch_loss_function,)@@ -393,4 +393,6 @@ if (Version(torch.__version__) < Version("2.4.0")) and \pass# Patch CE Losses in transformers-patch_loss_functions(fast_cross_entropy_loss)+def patch_loss_functions():+ _patch_loss_functions(fast_cross_entropy_loss)+passdiff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.pyindex f49c9db1ff2..45b9569c0d9 100644--- a/unsloth/models/_utils.py+++ b/unsloth/models/_utils.py@@ -48,6 +48,7 @@ __all__ = ["patch_regional_compilation","patch_layernorm","patch_torch_compile",+ "patch_loss_functions",]import torch