Skip to content

Commit

Permalink
catch error importing blocksparse tensor when triton not installed (f…
Browse files Browse the repository at this point in the history
…acebookresearch#213)

Co-authored-by: Diana Liskovich <dianaml@devfair0471.h2.fair>
  • Loading branch information
dianaml0 and Diana Liskovich authored Feb 8, 2022
1 parent aa6c77f commit 143318f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion xformers/sparse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

import logging

try:
from .blocksparse_tensor import BlockSparseTensor # noqa: F401
except ImportError as e:
logging.warning(
f"Triton is not available, some optimizations will not be enabled.\nError {e}"
)

from .blocksparse_tensor import BlockSparseTensor # noqa: F401
from .csr_tensor import SparseCSRTensor # noqa: F401

0 comments on commit 143318f

Please sign in to comment.