mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-25 07:18:58 +06:00
[bnb
] Add simple check for bnb import (#24995)
add simple check for bnb
This commit is contained in:
parent
f1a1eb4ae1
commit
d3ce048c20
@ -504,7 +504,14 @@ def is_ipex_available():
|
|||||||
|
|
||||||
|
|
||||||
def is_bitsandbytes_available():
|
def is_bitsandbytes_available():
|
||||||
return _bitsandbytes_available
|
if not is_torch_available():
|
||||||
|
return False
|
||||||
|
|
||||||
|
# bitsandbytes throws an error if cuda is not available
|
||||||
|
# let's avoid that by adding a simple check
|
||||||
|
import torch
|
||||||
|
|
||||||
|
return _bitsandbytes_available and torch.cuda.is_available()
|
||||||
|
|
||||||
|
|
||||||
def is_torchdistx_available():
|
def is_torchdistx_available():
|
||||||
|
Loading…
Reference in New Issue
Block a user