Skip to content

Commit 2adb440

Browse files
authored
[Bugfix] Fix ray instance detect issue (#9439)
1 parent feb92fb commit 2adb440

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

vllm/executor/ray_utils.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,16 @@ def initialize_ray_cluster(
232232

233233
# Connect to a ray cluster.
234234
if current_platform.is_rocm() or current_platform.is_xpu():
235-
ray.init(address=ray_address,
236-
ignore_reinit_error=True,
237-
num_gpus=parallel_config.world_size)
235+
# Try to connect existing ray instance and create a new one if not found
236+
try:
237+
ray.init("auto")
238+
except ConnectionError:
239+
logger.warning(
240+
"No existing RAY instance detected. "
241+
"A new instance will be launched with current node resources.")
242+
ray.init(address=ray_address,
243+
ignore_reinit_error=True,
244+
num_gpus=parallel_config.world_size)
238245
else:
239246
ray.init(address=ray_address, ignore_reinit_error=True)
240247

0 commit comments

Comments
 (0)