From e67c6b4ec958d3e02f202f6a6db36f8d44ecadd8 Mon Sep 17 00:00:00 2001 From: Daniel Han-Chen Date: Thu, 7 Mar 2024 02:05:38 +1100 Subject: [PATCH] Fix warning --- unsloth/__init__.py | 12 ++++++++---- unsloth/kernels/rms_layernorm.py | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/unsloth/__init__.py b/unsloth/__init__.py index 9dce29cd83..7080c92894 100644 --- a/unsloth/__init__.py +++ b/unsloth/__init__.py @@ -99,10 +99,14 @@ except: cdequantize_blockwise_fp32 = bnb.functional.lib.cdequantize_blockwise_fp32 libcuda_dirs() except: - raise ImportError("Unsloth: CUDA is not linked properly.\n"\ - "We tried running `ldconfig /usr/lib64-nvidia` ourselves, but it didn't work.\n"\ - "You need to run in your terminal `sudo ldconfig /usr/lib64-nvidia` yourself, then import Unsloth.\n"\ - "Also try `sudo ldconfig /usr/local/cuda-xx.x` - find the latest cuda version.") + warnings.warn( + "Unsloth: CUDA is not linked properly.\n"\ + "Try running `python -m bitsandbytes` then `python -m xformers.info`\n"\ + "We tried running `ldconfig /usr/lib64-nvidia` ourselves, but it didn't work.\n"\ + "You need to run in your terminal `sudo ldconfig /usr/lib64-nvidia` yourself, then import Unsloth.\n"\ + "Also try `sudo ldconfig /usr/local/cuda-xx.x` - find the latest cuda version.\n"\ + "Unsloth will still run for now, but maybe it might crash - let's hope it works!" + ) pass from .models import * diff --git a/unsloth/kernels/rms_layernorm.py b/unsloth/kernels/rms_layernorm.py index 8af602a857..4db89b7816 100644 --- a/unsloth/kernels/rms_layernorm.py +++ b/unsloth/kernels/rms_layernorm.py @@ -119,7 +119,7 @@ def _gemma_rms_layernorm_forward( W_row = tl.load(W + col_offsets, mask = mask, other = 0).to(tl.float32) row_var = tl.sum(X_row * X_row, axis = 0) / n_cols - inv_var = 1.0 / tl.sqrt(row_var + eps) + inv_var = 1.0 / tl.sqrt(row_var + eps) # Must be 1/sqrt to match Deepmind's impl tl.store(r, inv_var) normed = X_row * inv_var output = normed * (W_row + 1.0)