Skip to content

Commit

Permalink
Improve guard for triton compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewdouglas committed Jan 28, 2025
1 parent 8cd7793 commit c6d10f3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions bitsandbytes/triton/triton_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import importlib
import functools


@functools.lru_cache(None)
def is_triton_available():
return importlib.util.find_spec("triton") is not None
try:
# torch>=2.2.0
from torch.utils._triton import has_triton, has_triton_package

return has_triton_package() and has_triton()
except ImportError:
from torch._inductor.utils import has_triton

return has_triton()

0 comments on commit c6d10f3

Please sign in to comment.