Skip to content

Commit

Permalink
unify init logic for all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
yma11 committed Oct 22, 2024
1 parent 05607f3 commit 74b9123
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions vllm/executor/ray_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from vllm.logger import init_logger
from vllm.platforms import current_platform
from vllm.sequence import ExecuteModelRequest, IntermediateTensors
from vllm.utils import get_ip, is_hip, is_xpu
from vllm.utils import get_ip
from vllm.worker.worker_base import WorkerWrapperBase

logger = init_logger(__name__)
Expand Down Expand Up @@ -230,15 +230,17 @@ def initialize_ray_cluster(
"""
assert_ray_available()
# Connect to a ray cluster.
if is_hip() or is_xpu():
# Try to connect existing ray instance and create a new one if not found
if ray_address is None:
# Try to connect latest created 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,
"Neither ray_address specified nor existing RAY instance"
" detected. A new instance will be launched with current"
" node resources.")
ray.init(address=None,
ignore_reinit_error=True,
num_gpus=parallel_config.world_size)
else:
Expand Down

0 comments on commit 74b9123

Please sign in to comment.