From a458d59e9116368b8d18009e18cb7b015e3258d6 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Wed, 19 Nov 2025 23:56:38 -0800 Subject: [PATCH] Update __init__.py --- unsloth/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unsloth/__init__.py b/unsloth/__init__.py index 8b48ce3ba0..c2311a93bf 100644 --- a/unsloth/__init__.py +++ b/unsloth/__init__.py @@ -177,6 +177,7 @@ if DEVICE_TYPE == "cuda": print( "Unsloth: `bitsandbytes` is not installed - 4bit QLoRA unallowed, but 16bit and full finetuning works!" ) + bnb = None try: cdequantize_blockwise_fp32 = bnb.functional.lib.cdequantize_blockwise_fp32 libcuda_dirs() @@ -209,7 +210,8 @@ if DEVICE_TYPE == "cuda": del find_number, latest_cuda del possible_cudas, find_cuda - importlib.reload(bnb) + if bnb is not None: + importlib.reload(bnb) importlib.reload(triton) try: libcuda_dirs = lambda: None