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.

Update utils.py

Daniel Han4e4bdc4fcf7c
diff --git a/unsloth/kernels/utils.py b/unsloth/kernels/utils.py
index a8c20c75a47..b394d122fd2 100644
--- a/unsloth/kernels/utils.py
+++ b/unsloth/kernels/utils.py
@@ -13,7 +13,7 @@
# limitations under the License.
import triton
-MAX_FUSED_SIZE = 65536
+MAX_FUSED_SIZE : int = 65536
next_power_of_2 = triton.next_power_of_2
# torch.cuda.amp.custom_fwd is deprecated >= 2.4
@@ -40,12 +40,12 @@ else:
pass
-def calculate_settings(n):
- BLOCK_SIZE = next_power_of_2(n)
+def calculate_settings(n : int) -> (int, int,):
+ BLOCK_SIZE : int = next_power_of_2(n)
if BLOCK_SIZE > MAX_FUSED_SIZE:
raise RuntimeError(f"Cannot launch Triton kernel since n = {n} exceeds "\
f"the maximum CUDA blocksize = {MAX_FUSED_SIZE}.")
- num_warps = 4
+ num_warps : int = 4
if BLOCK_SIZE >= 32768: num_warps = 32
elif BLOCK_SIZE >= 8192: num_warps = 16
elif BLOCK_SIZE >= 2048: num_warps = 8