Initialize flash attn flag (#38768)

_flash_supports_window_size is used further down in this file and relied on by e.g. [ring-flash-attention](https://github.com/zhuzilin/ring-flash-attention/blob/123f924/ring_flash_attn/adapters/hf_adapter.py#L9-L11). Even though it is an unexported name, it still makes sense to keep the state of `globals()` in this file consistent.
This commit is contained in:
Mohammad Nasirifar 2025-06-12 07:06:13 -07:00 committed by GitHub
parent 910355a010
commit 038a59e2cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -46,6 +46,9 @@ if is_torch_npu_available():
from .integrations.npu_flash_attention import npu_flash_attn_varlen_func as flash_attn_varlen_func
_flash_supports_window_size = False
if flash_attn_func:
_flash_supports_window_size = "window_size" in list(inspect.signature(flash_attn_func).parameters)