Skip to content

Commit

Permalink
Fix flash attention speed issue (#32028)
Browse files Browse the repository at this point in the history
Add the lru_cache for speed
  • Loading branch information
Cyrilvallez authored and itazap committed Jul 25, 2024
1 parent 4ae66b2 commit 72a6d4b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/transformers/utils/import_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ def is_flash_attn_greater_or_equal_2_10():
return version.parse(importlib.metadata.version("flash_attn")) >= version.parse("2.1.0")


@lru_cache()
def is_flash_attn_greater_or_equal(library_version: str):
if not _is_package_available("flash_attn"):
return False
Expand Down

0 comments on commit 72a6d4b

Please sign in to comment.