Skip to content

Commit

Permalink
Loosen requirement on packaging dependency (#1758)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffra authored Feb 10, 2022
1 parent dac9056 commit dbe8ee1
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions op_builder/sparse_attn.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
"""
import warnings
from .builder import OpBuilder
from packaging import version as pkg_version

try:
from packaging import version as pkg_version
except ImportError:
pkg_version = None


class SparseAttnBuilder(OpBuilder):
Expand Down Expand Up @@ -62,8 +66,14 @@ def is_compatible(self, verbose=True):
f"please install triton==1.0.0 if you want to use sparse attention")
return False

installed_triton = pkg_version.parse(triton.__version__)
if installed_triton != pkg_version.parse("1.0.0"):
if pkg_version:
installed_triton = pkg_version.parse(triton.__version__)
triton_mismatch = installed_triton != pkg_version.parse("1.0.0")
else:
installed_triton = triton.__version__
triton_mismatch = installed_triton != "1.0.0"

if triton_mismatch:
self.warning(
f"using untested triton version ({installed_triton}), only 1.0.0 is known to be compatible"
)
Expand Down

0 comments on commit dbe8ee1

Please sign in to comment.