Skip to content

Commit

Permalink
Fix ray instance detect issue
Browse files Browse the repository at this point in the history
  • Loading branch information
yma11 committed Oct 22, 2024
1 parent ca30c3c commit 13f04c4
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions vllm/executor/ray_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,18 @@ def initialize_ray_cluster(
the default Ray cluster address.
"""
assert_ray_available()

# Connect to a ray cluster.
if is_hip() or is_xpu():
ray.init(address=ray_address,
ignore_reinit_error=True,
num_gpus=parallel_config.world_size)
# Try to connect existing ray instance and create a new one if not found
try:
ray.init('auto')
except ConnectionError:
logger.warning(
"No existing RAY instance detected. "
"A new instance will be launched with current node resources.")
ray.init(address=ray_address,
ignore_reinit_error=True,
num_gpus=parallel_config.world_size)
else:
ray.init(address=ray_address, ignore_reinit_error=True)

Expand Down

0 comments on commit 13f04c4

Please sign in to comment.