Skip to content

Commit 2938cf0

Browse files
committed
Add a switch to custom_allgather import
1 parent 0fcedc0 commit 2938cf0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lightllm/common/vllm_kernel/_custom_ops.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
logger.error("vllm or lightllm_kernel is not installed, you can't use custom ops")
1717

1818
try:
19-
from lightllm.common.vllm_kernel._ops import init_custom_gather_ar
20-
from lightllm.common.vllm_kernel._ops import all_gather
21-
from lightllm.common.vllm_kernel._ops import allgather_dispose
22-
from lightllm.common.vllm_kernel._ops import allgather_register_buffer
23-
from lightllm.common.vllm_kernel._ops import allgather_get_graph_buffer_ipc_meta
24-
from lightllm.common.vllm_kernel._ops import allgather_register_graph_buffers
19+
ENABLE_CUSTOM_GATHER = os.getenv("ENABLE_CUSTOM_GATHER", "False").upper() in ["ON", "TRUE", "1"]
20+
if ENABLE_CUSTOM_GATHER:
21+
from lightllm.common.vllm_kernel._ops import init_custom_gather_ar
22+
from lightllm.common.vllm_kernel._ops import all_gather
23+
from lightllm.common.vllm_kernel._ops import allgather_dispose
24+
from lightllm.common.vllm_kernel._ops import allgather_register_buffer
25+
from lightllm.common.vllm_kernel._ops import allgather_get_graph_buffer_ipc_meta
26+
from lightllm.common.vllm_kernel._ops import allgather_register_graph_buffers
2527
except ImportError:
2628
logger.error("lightllm_kernel is not installed, you can't use custom allgather")

0 commit comments

Comments
 (0)