Skip to content

Commit 11ac0ba

Browse files
committed
update
1 parent 56c70cc commit 11ac0ba

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

lightllm/utils/sgl_utils.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,30 @@
33
logger = init_logger(__name__)
44
try:
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
1410
except:
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+
)

0 commit comments

Comments
 (0)