File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -66,3 +66,7 @@ def get_flash_attn_version(requires_alibi: bool = False) -> Optional[int]:
66
66
def flash_attn_supports_fp8 () -> bool :
67
67
return get_flash_attn_version () == 3 and \
68
68
current_platform .get_device_capability ().major == 9
69
+
70
+
71
+ def is_flash_attn_varlen_func_available () -> bool :
72
+ return current_platform .is_cuda () or current_platform .is_xpu ()
Original file line number Diff line number Diff line change 14
14
from vllm .attention .layer import Attention
15
15
from vllm .attention .ops .merge_attn_states import merge_attn_states
16
16
from vllm .attention .utils .fa_utils import (flash_attn_supports_fp8 ,
17
- flash_attn_varlen_func ,
18
17
get_flash_attn_version ,
19
- get_scheduler_metadata ,
20
- reshape_and_cache_flash )
18
+ is_flash_attn_varlen_func_available )
19
+
20
+ if is_flash_attn_varlen_func_available ():
21
+ from vllm .attention .utils .fa_utils import (flash_attn_varlen_func ,
22
+ get_scheduler_metadata ,
23
+ reshape_and_cache_flash )
24
+
21
25
from vllm .config import VllmConfig , get_layers_from_vllm_config
22
26
from vllm .logger import init_logger
23
27
from vllm .utils import cdiv
You can’t perform that action at this time.
0 commit comments