File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change 1717from __future__ import annotations
1818
1919import os
20+ import importlib .util
2021from importlib .metadata import PackageNotFoundError , version
2122from typing import Dict , List , Optional , Union
2223
@@ -437,7 +438,7 @@ def skip(*args, **kwargs):
437438 args [ATTN_IMPLEMENTATION ] = kwargs .pop (ATTN_IMPLEMENTATION , None )
438439 if USE_FLASH_ATTENTION_2 in kwargs :
439440 args [USE_FLASH_ATTENTION_2 ] = kwargs .pop (USE_FLASH_ATTENTION_2 , None )
440- if not args :
441+ if not args and importlib . util . find_spec ( "flash_attn" ) is not None :
441442 has_attn_implementation = Version (transformers .__version__ ) >= Version ("4.46.0" )
442443 if is_flash_attn_2_available () and has_attn_implementation :
443444 args = {ATTN_IMPLEMENTATION : "flash_attention_2" }
You can’t perform that action at this time.
0 commit comments