File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed
Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change 33logger = init_logger (__name__ )
44try :
55 import sgl_kernel
6- from sgl_kernel .flash_attn import flash_attn_varlen_func , flash_attn_with_kvcache
76
87 sgl_ops = sgl_kernel
98 sgl_allreduce_ops = sgl_ops .allreduce
10- flash_attn_varlen_func = flash_attn_varlen_func
11- flash_attn_with_kvcache = flash_attn_with_kvcache
12- merge_state_v2 = sgl_ops .merge_state_v2
139 HAS_SGL_KERNEL = True
1410except :
1511 sgl_ops = None
1612 sgl_allreduce_ops = None
17- flash_attn_varlen_func = None
18- flash_attn_with_kvcache = None
19- merge_state_v2 = None
2013 HAS_SGL_KERNEL = False
2114 logger .warning (
2215 "sgl_kernel is not installed, you can't use the api of it. \
2316 You can solve it by running `pip install sgl_kernel`."
2417 )
18+
19+ try :
20+ from sgl_kernel .flash_attn import flash_attn_varlen_func , flash_attn_with_kvcache
21+
22+ flash_attn_varlen_func = flash_attn_varlen_func
23+ flash_attn_with_kvcache = flash_attn_with_kvcache
24+ merge_state_v2 = sgl_ops .merge_state_v2
25+ except :
26+ flash_attn_varlen_func = None
27+ flash_attn_with_kvcache = None
28+ merge_state_v2 = None
29+ logger .warning (
30+ "sgl_kernel is not installed, or the installed version did not support fa3. \
31+ Try to upgrade it."
32+ )
You can’t perform that action at this time.
0 commit comments