[Misc] Delay EPLB Nixl import until needed (#41805)

Signed-off-by: NickLucche <nlucches@redhat.com>
This commit is contained in:
Nicolò Lucchesi
2026-05-07 09:43:07 -07:00
committed by GitHub
parent 7a08b34fbf
commit 9d6500b89d
+4 -4
View File
@@ -23,10 +23,6 @@ from vllm.distributed.device_communicators.pynccl import PyNcclCommunicator
from vllm.distributed.device_communicators.pynccl_wrapper import (
ncclDataTypeEnum,
)
from vllm.distributed.nixl_utils import (
NixlWrapper,
nixl_agent_config,
)
from vllm.distributed.parallel_state import (
GroupCoordinator,
get_pp_group,
@@ -41,6 +37,8 @@ logger = init_logger(__name__)
def has_nixl() -> bool:
"""Whether the optional NIXL / RIXL package is available."""
from vllm.distributed.nixl_utils import NixlWrapper
return NixlWrapper is not None
@@ -235,6 +233,8 @@ class NixlEplbCommunicator(EplbCommunicator):
expert_weights: Sequence[torch.Tensor],
cuda_stream: torch.cuda.Stream | None = None,
) -> None:
from vllm.distributed.nixl_utils import NixlWrapper, nixl_agent_config
assert expert_weights, "NixlEplbCommunicator requires non-empty expert_weights."
if NixlWrapper is None:
raise RuntimeError("NIXL/ RIXL is unavailable.")