[bugfix] fix early import of flash attention (#12959)

Signed-off-by: youkaichao <youkaichao@gmail.com>
This commit is contained in:
youkaichao
2025-02-09 00:06:56 +08:00
committed by GitHub
parent 913df14da3
commit fe743b798d
4 changed files with 20 additions and 19 deletions
+6 -8
View File
@@ -587,11 +587,11 @@ def get_num_prefill_decode_query_kv_tokens(
num_decode_query_tokens)
try:
from vllm.vllm_flash_attn.flash_attn_interface import (
fa_version_unsupported_reason, is_fa_version_supported)
def get_flash_attn_version():
try:
from vllm.vllm_flash_attn.flash_attn_interface import (
fa_version_unsupported_reason, is_fa_version_supported)
def flash_attn_version():
# if hopper default to FA3, otherwise stick to FA2 for now
# TODO(lucas): profile FA3 on ampere to see if it makes sense to
# use FA3 as default for both
@@ -610,7 +610,5 @@ try:
assert is_fa_version_supported(fa_version)
return fa_version
VLLM_FLASH_ATTN_VERSION = flash_attn_version()
except (ImportError, AssertionError):
VLLM_FLASH_ATTN_VERSION = None
except (ImportError, AssertionError):
return None