Skip to content

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.

constexpr

Daniel Hand2725e791011
diff --git a/unsloth/kernels/cross_entropy_loss.py b/unsloth/kernels/cross_entropy_loss.py
index 91b57fe85d9..9cf7ddc36d6 100644
--- a/unsloth/kernels/cross_entropy_loss.py
+++ b/unsloth/kernels/cross_entropy_loss.py
@@ -38,9 +38,9 @@ def _cross_entropy_forward(
labels_ptr ,
VOCAB_SIZE : tl.constexpr,
BLOCK_SIZE : tl.constexpr,
- DO_SOFTCAPPING : tl.constexpr,
+ DO_SOFTCAPPING ,
SOFTCAP : tl.constexpr,
- DO_LOGIT_SCALING : tl.constexpr,
+ DO_LOGIT_SCALING ,
LOGIT_SCALE : tl.constexpr,
):
"""
@@ -112,9 +112,9 @@ def _chunked_cross_entropy_forward(
VOCAB_SIZE : tl.constexpr,
N_CHUNKS : tl.constexpr,
BLOCK_SIZE : tl.constexpr,
- DO_SOFTCAPPING : tl.constexpr,
+ DO_SOFTCAPPING ,
SOFTCAP : tl.constexpr,
- DO_LOGIT_SCALING : tl.constexpr,
+ DO_LOGIT_SCALING ,
LOGIT_SCALE : tl.constexpr,
):
"""
@@ -195,9 +195,9 @@ def _cross_entropy_backward(
labels_ptr ,
VOCAB_SIZE : tl.constexpr,
BLOCK_SIZE : tl.constexpr,
- DO_SOFTCAPPING : tl.constexpr,
+ DO_SOFTCAPPING ,
SOFTCAP : tl.constexpr,
- DO_LOGIT_SCALING : tl.constexpr,
+ DO_LOGIT_SCALING ,
LOGIT_SCALE : tl.constexpr,
):
"""
diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py
index c309e1c1cda..dd37d26ae41 100644
--- a/unsloth/models/_utils.py
+++ b/unsloth/models/_utils.py
@@ -366,8 +366,8 @@ pass
# =============================================
# Torch compile settings
-UNSLOTH_COMPILE_DEBUG = True
-
+UNSLOTH_COMPILE_DEBUG = "UNSLOTH_COMPILE_DEBUG" in os.environ
+UNSLOTH_COMPILE_MAXIMUM = "UNSLOTH_COMPILE_MAXIMUM" in os.environ
# Just remove max_autotune_gemm warning
import functools
@functools.lru_cache(None)
@@ -379,7 +379,7 @@ def is_big_gpu(index):
return True
import torch._inductor.utils
torch._inductor.utils.is_big_gpu = is_big_gpu
-patch_torch_compile(debug = UNSLOTH_COMPILE_DEBUG, O3 = False)
+patch_torch_compile(debug = UNSLOTH_COMPILE_DEBUG, O3 = UNSLOTH_COMPILE_MAXIMUM)
torch_compile_options = {
"epilogue_fusion" : True,