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 Han27cd2b3a0de1
diff --git a/unsloth/kernels/cross_entropy_loss.py b/unsloth/kernels/cross_entropy_loss.pyindex f0193c74d8a..13d90baafe9 100644--- a/unsloth/kernels/cross_entropy_loss.py+++ b/unsloth/kernels/cross_entropy_loss.py@@ -181,10 +181,10 @@ def _chunked_cross_entropy_forward(pass- "DO_SOFTCAPPING": lambda args: bool(args["DO_SOFTCAPPING" ]),- "DO_LOGIT_SCALING": lambda args: bool(args["DO_LOGIT_SCALING"]),-})+# @triton.heuristics({+# "DO_SOFTCAPPING": lambda args: bool(args["DO_SOFTCAPPING" ]),+# "DO_LOGIT_SCALING": lambda args: bool(args["DO_LOGIT_SCALING"]),+# })@triton.jitdef _cross_entropy_backward(logits_ptr ,@@ -345,6 +345,8 @@ class Fast_CrossEntropyLoss(torch.autograd.Function):n_rows, vocab_size = logits.shapeBLOCK_SIZE : int = 4096+ div : int+ mod : intdiv, mod = divmod(vocab_size, BLOCK_SIZE)n_blocks : int = div + (mod != 0)diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.pyindex b5c17434c70..bb004d588d5 100644--- a/unsloth/models/_utils.py+++ b/unsloth/models/_utils.py@@ -393,7 +393,7 @@ UNSLOTH_COMPILE_DEBUG = os.environ.get("UNSLOTH_COMPILE_DEBUG", "0") == "1"UNSLOTH_COMPILE_MAXIMUM = os.environ.get("UNSLOTH_COMPILE_MAXIMUM", "0") == "1"patch_torch_compile(debug = UNSLOTH_COMPILE_DEBUG,- O3 = UNSLOTH_COMPILE_MAXIMUM,+ O3 = UNSLOTH_COMPILE_MAXIMUM,)torch_compile_options = {