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
Update utils.py
Daniel Han9296a6a93d6b
diff --git a/unsloth/kernels/utils.py b/unsloth/kernels/utils.pyindex d4f31d0e41d..8537e9595e8 100644--- a/unsloth/kernels/utils.py+++ b/unsloth/kernels/utils.py@@ -175,16 +175,27 @@ if HAS_CUDA_STREAM:# NF4 dequantization of statisticsptr_out_absmax = get_ptr(out_absmax)cdequantize_blockwise_fp32(- get_ptr(code2), get_ptr(absmax), get_ptr(absmax2), ptr_out_absmax,- ctypes.c_int(blocksize2), ctypes.c_int(n_elements_absmax), CUDA_STREAM,+ get_ptr(code2),+ get_ptr(absmax),+ get_ptr(absmax2),+ ptr_out_absmax,+ ctypes.c_int(blocksize2),+ ctypes.c_int(n_elements_absmax),+ CUDA_STREAM,)out_absmax += offset# Dequantize Wfx = cdequantize_blockwise_fp16_nf4 if dtype == torch.float16 else \cdequantize_blockwise_bf16_nf4- fx(get_ptr(None), get_ptr(W), ptr_out_absmax, get_ptr(out),- ctypes.c_int(blocksize), ctypes.c_int(out.numel()), CUDA_STREAM,)+ fx(+ get_ptr(None),+ get_ptr(W),+ ptr_out_absmax,+ get_ptr(out),+ ctypes.c_int(blocksize),+ ctypes.c_int(out.numel()),+ CUDA_STREAM,)# Careful returning transposed datais_transposed = (True if W.shape[0] == 1 else False)@@ -242,25 +253,15 @@ else:# Do dequantizationptr_out_absmax = get_ptr(out_absmax)cdequantize_blockwise_fp32(- get_ptr(code2),- get_ptr(absmax),- get_ptr(absmax2),- ptr_out_absmax,- ctypes.c_int(blocksize2),- ctypes.c_int(n_elements_absmax),+ get_ptr(code2), get_ptr(absmax), get_ptr(absmax2), ptr_out_absmax,+ ctypes.c_int(blocksize2), ctypes.c_int(n_elements_absmax),)out_absmax += offsetfx = cdequantize_blockwise_fp16_nf4 if dtype == torch.float16 else \cdequantize_blockwise_bf16_nf4- fx(- get_ptr(None),- get_ptr(W),- ptr_out_absmax,- get_ptr(out),- ctypes.c_int(blocksize),- ctypes.c_int(out.numel()),- )+ fx(get_ptr(None), get_ptr(W), ptr_out_absmax, get_ptr(out),+ ctypes.c_int(blocksize), ctypes.c_int(out.numel()),)# Careful returning transposed datais_transposed = (True if W.shape[0] == 1 else False)