From 2ea6c270a398d600c070a1c7edef70412fc689c2 Mon Sep 17 00:00:00 2001 From: Nick Hill Date: Sat, 15 Jun 2024 16:30:51 -0700 Subject: [PATCH] [BugFix] Don't start a Ray cluster when not using Ray (#5570) --- vllm/config.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vllm/config.py b/vllm/config.py index 54f36e1d66783..c0d294ce942e1 100644 --- a/vllm/config.py +++ b/vllm/config.py @@ -616,9 +616,14 @@ def __init__( "required for multi-node inference") backend = "ray" elif ray_found: - from ray.util import get_current_placement_group - if self.placement_group or get_current_placement_group(): + if self.placement_group: backend = "ray" + else: + from ray import is_initialized as ray_is_initialized + if ray_is_initialized(): + from ray.util import get_current_placement_group + if get_current_placement_group(): + backend = "ray" self.distributed_executor_backend = backend logger.info("Defaulting to use %s for distributed inference", backend)