Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
5f14e467
Commit
5f14e467
authored
Mar 01, 2025
by
Piotr Marcinkiewicz
Committed by
GitHub
Mar 01, 2025
Browse files
Add lazy import to nixl.py
parent
9162f3ad
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
18 deletions
+14
-18
container/deps/vllm/vllm_v0.7.2-triton-kv-disagg-patch.patch
container/deps/vllm/vllm_v0.7.2-triton-kv-disagg-patch.patch
+14
-4
examples/python_rs/llm/vllm/__init__.py
examples/python_rs/llm/vllm/__init__.py
+0
-14
examples/python_rs/llm/vllm/common/__init__.py
examples/python_rs/llm/vllm/common/__init__.py
+0
-0
examples/python_rs/llm/vllm/monolith/__init__.py
examples/python_rs/llm/vllm/monolith/__init__.py
+0
-0
No files found.
container/deps/vllm/vllm_v0.7.2-triton-kv-disagg-patch.patch
View file @
5f14e467
...
@@ -618,11 +618,9 @@ index 00000000..bc962726
...
@@ -618,11 +618,9 @@ index 00000000..bc962726
+import msgspec
+import msgspec
+import time
+import time
+import uuid
+import uuid
+from nixl_wrapper import nixl_wrapper as NixlWrapper
+
+
+logger = init_logger(__name__)
+logger = init_logger(__name__)
+
+
+
+def nixl_wrapper_init_patch(self, agent_name, nixl_config):
+def nixl_wrapper_init_patch(self, agent_name, nixl_config):
+ logger.info("Initializing patched NixlWrapper")
+ logger.info("Initializing patched NixlWrapper")
+ import nixl_bindings as nixl
+ import nixl_bindings as nixl
...
@@ -646,9 +644,17 @@ index 00000000..bc962726
...
@@ -646,9 +644,17 @@ index 00000000..bc962726
+ "WRITE_NOTIF": nixl.NIXL_WR_NOTIF,
+ "WRITE_NOTIF": nixl.NIXL_WR_NOTIF,
+ "READ_NOTIF": nixl.NIXL_RD_NOTIF}
+ "READ_NOTIF": nixl.NIXL_RD_NOTIF}
+
+
+ print("Initializied NIXL agent:", agent_name)
+ logger.info("Initializied NIXL agent: %s", agent_name)
+
+
+
+NixlWrapper.__init__ = nixl_wrapper_init_patch
+# Lazy import nixl_wrapper to avoid loading nixl_bindings if nixl is not used
+try:
+ from nixl_wrapper import nixl_wrapper as NixlWrapper # type: ignore
+ logger.info("NIXL is available")
+ NixlWrapper.__init__ = nixl_wrapper_init_patch
+except ImportError:
+ logger.warning("NIXL is not available")
+ NixlWrapper = None
+
+
+
+
+
+
...
@@ -665,6 +671,10 @@ index 00000000..bc962726
...
@@ -665,6 +671,10 @@ index 00000000..bc962726
+class TritonNixlConnector:
+class TritonNixlConnector:
+ def __init__(self, vllm_config: VllmConfig, engine_id: str, rank: int):
+ def __init__(self, vllm_config: VllmConfig, engine_id: str, rank: int):
+ self.vllm_config = vllm_config
+ self.vllm_config = vllm_config
+ if NixlWrapper is None:
+ logger.error("NIXL is not available")
+ raise RuntimeError("NIXL is not available")
+ logger.info("Initializing NIXL wrapper")
+ self.nixl_wrapper = NixlWrapper(str(uuid.uuid4()), None)
+ self.nixl_wrapper = NixlWrapper(str(uuid.uuid4()), None)
+
+
+ self.num_layers = None
+ self.num_layers = None
...
...
examples/python_rs/llm/vllm/__init__.py
deleted
100644 → 0
View file @
9162f3ad
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
examples/python_rs/llm/vllm/common/__init__.py
deleted
100644 → 0
View file @
9162f3ad
examples/python_rs/llm/vllm/monolith/__init__.py
deleted
100644 → 0
View file @
9162f3ad
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment