Skip to content

Commit 49438d7

Browse files
committed
[LLM] Fix dependency graph paper cuts in serve llm
- Move CloudFileSystem import to module top level in cloud_downloader.py (was inline inside method) - Move KVConnectorBackendFactory import to lazy local import inside _setup_kv_connector_backend() to avoid llm_config depending on engine-specific components at module load time Signed-off-by: ps2181 <hellopritam31@gmail.com>
1 parent 8dcdff8 commit 49438d7

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

python/ray/llm/_internal/common/callbacks/cloud_downloader.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from pydantic import BaseModel, field_validator
66

7+
from ray.llm._internal.common.utils.cloud_utils import CloudFileSystem
78
from .base import CallbackBase
89

910
logger = logging.getLogger(__name__)
@@ -74,8 +75,6 @@ def __init__(self, **kwargs: Any) -> None:
7475

7576
def on_before_download_model_files_distributed(self) -> None:
7677
"""Download files from cloud storage to local paths before model files are downloaded."""
77-
from ray.llm._internal.common.utils.cloud_utils import CloudFileSystem
78-
7978
paths = self.kwargs["paths"]
8079
start_time = time.monotonic()
8180
for cloud_uri, local_path in paths:

python/ray/llm/_internal/serve/core/configs/llm_config.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@
4444
TPUConfig,
4545
infer_hardware_kind_from_bundles,
4646
)
47-
from ray.llm._internal.serve.engines.vllm.kv_transfer.factory import (
48-
KVConnectorBackendFactory,
49-
)
5047
from ray.llm._internal.serve.observability.logging import get_logger
5148
from ray.serve._private.config import DeploymentConfig, handle_num_replicas_auto
5249

@@ -609,6 +606,10 @@ def _setup_kv_connector_backend(self):
609606
raise ValueError("Connector type is not specified.")
610607

611608
# 2. Setup the backend using factory
609+
from ray.llm._internal.serve.engines.vllm.kv_transfer.factory import (
610+
KVConnectorBackendFactory,
611+
)
612+
612613
kv_connector_backend = KVConnectorBackendFactory.create_backend(
613614
kv_connector, self
614615
)

0 commit comments

Comments
 (0)