Skip to content

Commit 54a2ad5

Browse files
authored
Remove error log for Intel CPU/XPU (#1503)
* fix intel cpu/xpu warning Signed-off-by: jiqing-feng <[email protected]> * fix error log Signed-off-by: jiqing-feng <[email protected]> * fix lib Signed-off-by: jiqing-feng <[email protected]> * rm return Nonr Signed-off-by: jiqing-feng <[email protected]> * error log only without ipex Signed-off-by: jiqing-feng <[email protected]> * fix import eerror Signed-off-by: jiqing-feng <[email protected]> * fix format Signed-off-by: jiqing-feng <[email protected]> --------- Signed-off-by: jiqing-feng <[email protected]>
1 parent d180d8e commit 54a2ad5

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

bitsandbytes/cextension.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ def get_native_library() -> BNBNativeLibrary:
9393

9494
ROCM_GPU_ARCH = get_rocm_gpu_arch()
9595

96+
try:
97+
import intel_extension_for_pytorch as ipex
98+
99+
assert ipex._C._has_cpu() or ipex._C._has_xpu()
100+
is_ipex_available = True
101+
except Exception:
102+
is_ipex_available = False
103+
96104
try:
97105
if torch.version.hip:
98106
hip_major, hip_minor = map(int, torch.version.hip.split(".")[0:2])
@@ -107,16 +115,17 @@ def get_native_library() -> BNBNativeLibrary:
107115
lib = get_native_library()
108116
except Exception as e:
109117
lib = None
110-
logger.error(f"Could not load bitsandbytes native library: {e}", exc_info=True)
111-
if torch.cuda.is_available():
112-
logger.warning(
113-
f"""
114-
{BNB_BACKEND} Setup failed despite {BNB_BACKEND} being available. Please run the following command to get more information:
115-
116-
python -m bitsandbytes
117-
118-
Inspect the output of the command and see if you can locate {BNB_BACKEND} libraries. You might need to add them
119-
to your LD_LIBRARY_PATH. If you suspect a bug, please take the information from python -m bitsandbytes
120-
and open an issue at: https://github.com/bitsandbytes-foundation/bitsandbytes/issues
121-
""",
122-
)
118+
if not is_ipex_available:
119+
logger.error(f"Could not load bitsandbytes native library: {e}", exc_info=True)
120+
if torch.cuda.is_available():
121+
logger.warning(
122+
f"""
123+
{BNB_BACKEND} Setup failed despite {BNB_BACKEND} being available. Please run the following command to get more information:
124+
125+
python -m bitsandbytes
126+
127+
Inspect the output of the command and see if you can locate {BNB_BACKEND} libraries. You might need to add them
128+
to your LD_LIBRARY_PATH. If you suspect a bug, please take the information from python -m bitsandbytes
129+
and open an issue at: https://github.com/bitsandbytes-foundation/bitsandbytes/issues
130+
""",
131+
)

docs/source/installation.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,10 @@ pip install -e . # `-e` for "editable" install, when developing BNB (otherwise
341341
</hfoption>
342342
<hfoption id="Intel CPU + GPU">
343343

344-
#### Intel CPU
344+
#### Intel CPU / XPU
345345

346346
> [!TIP]
347-
> Intel CPU backend only supports building from source; for now, please follow the instructions below.
347+
> Intel CPU / XPU backend only supports building from source; for now, please follow the instructions below.
348348
349349
Similar to the CUDA case, you can compile bitsandbytes from source for Linux and Windows systems.
350350

0 commit comments

Comments
 (0)