[Bugfix] Add verbose error if scipy is missing for blocksparse attention (#5695)

This commit is contained in:
JGSweets 2024-07-05 12:41:01 -05:00 committed by GitHub
parent f1e15da6fe
commit e58294ddf2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,7 +6,14 @@ from functools import lru_cache
import torch
import triton
from scipy import sparse
try:
from scipy import sparse
except ImportError as err:
raise ImportError("Please install scipy via "
"`pip install scipy` to use "
"BlockSparseAttention in "
"models such as Phi-3.") from err
def dense_to_crow_col(x: torch.Tensor):