[Core] Cleanup Omni connector runtime and transfer backends (#5096)
Signed-off-by: spencerr221 <liubingyu62@gmail.com>
This commit is contained in:
1 parent
2cf5f57b3e
commit
dcf8b07d39
53 files changed
+349
-448
No files matched your search
@@ -323,7 +323,6 @@ class GPUARModelRunner(OmniGPUModelRunner, OmniConnectorModelRunnerMixin):
|
||||
}
|
||||
if getattr(self.model_config, "model_arch", None) in _OMNI_CONNECTOR_INIT_ARCHS:
|
||||
self.init_omni_connectors(
|
||||
vllm_config=self.vllm_config,
|
||||
model_config=self.model_config,
|
||||
kv_transfer_manager=self.kv_transfer_manager,
|
||||
)
|
||||
|
||||
@@ -70,7 +70,6 @@ class GPUGenerationModelRunner(OmniGPUModelRunner, OmniConnectorModelRunnerMixin
|
||||
}
|
||||
if getattr(self.model_config, "model_arch", None) in _OMNI_CONNECTOR_INIT_ARCHS:
|
||||
self.init_omni_connectors(
|
||||
vllm_config=self.vllm_config,
|
||||
model_config=self.model_config,
|
||||
)
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ import inspect
|
||||
import os
|
||||
import threading
|
||||
from collections import defaultdict, deque
|
||||
from types import SimpleNamespace
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
import torch
|
||||
@@ -36,6 +35,7 @@ from vllm_omni.worker.payload_span import (
|
||||
_EMBED_SPAN_GROUPS: tuple[tuple[str, str, str], ...] = (("decode", "decode_token_start", "decode_token_end"),)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from vllm_omni.config.model import OmniModelConfig
|
||||
from vllm_omni.distributed.omni_connectors.connectors.base import (
|
||||
OmniConnectorBase,
|
||||
)
|
||||
@@ -87,14 +87,12 @@ class OmniConnectorModelRunnerMixin:
|
||||
|
||||
def init_omni_connectors(
|
||||
self,
|
||||
vllm_config: Any,
|
||||
model_config: Any,
|
||||
model_config: OmniModelConfig,
|
||||
kv_transfer_manager: OmniKVTransferManager | None = None,
|
||||
) -> None:
|
||||
"""Initialize connectors and background threads.
|
||||
|
||||
Args:
|
||||
vllm_config: Full vLLM config object.
|
||||
model_config: Stage-level model config with connector settings.
|
||||
kv_transfer_manager: Existing KV transfer manager to delegate to.
|
||||
"""
|
||||
@@ -1024,31 +1022,6 @@ class OmniConnectorModelRunnerMixin:
|
||||
self._work_available.set()
|
||||
return sent_ids
|
||||
|
||||
def recv_stage_inputs(self, scheduler_output: Any) -> dict[str, Any] | None:
|
||||
"""Compatibility wrapper for ``recv_full_payload_inputs``."""
|
||||
return self.recv_full_payload_inputs(scheduler_output)
|
||||
|
||||
def accumulate_batch_output(
|
||||
self,
|
||||
req_id: str,
|
||||
pooler_output: Any,
|
||||
request: Any,
|
||||
) -> None:
|
||||
"""Compatibility wrapper for ``accumulate_full_payload_output``."""
|
||||
self.accumulate_full_payload_output(req_id, pooler_output, request)
|
||||
|
||||
def flush_batch_outputs(self, finished_req_ids: set[str]) -> None:
|
||||
"""Compatibility wrapper for ``flush_full_payload_outputs``."""
|
||||
self.flush_full_payload_outputs(finished_req_ids)
|
||||
|
||||
def send_stage_outputs(
|
||||
self,
|
||||
scheduler_output: Any,
|
||||
outputs: dict[str, tuple[Any, Any] | Any],
|
||||
) -> list[str]:
|
||||
"""Compatibility wrapper for ``send_full_payload_outputs``."""
|
||||
return self.send_full_payload_outputs(scheduler_output, outputs)
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# Streaming chunk mode (recv_chunk / send_chunk)
|
||||
# ------------------------------------------------------------------ #
|
||||
@@ -1505,20 +1478,6 @@ class OmniConnectorModelRunnerMixin:
|
||||
# Output aggregation
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
def _empty_output_with_connector_signals(self) -> Any:
|
||||
"""Return a minimal ModelRunnerOutput carrying pending connector signals.
|
||||
|
||||
Used by early-return paths (e.g. ``num_scheduled_tokens == 0``)
|
||||
that still need to deliver ``omni_connector_output`` to the
|
||||
Scheduler so that WAITING_FOR_INPUT / WAITING_FOR_CHUNK
|
||||
transitions are not lost.
|
||||
"""
|
||||
from vllm_omni.outputs import OmniModelRunnerOutput
|
||||
|
||||
output = OmniModelRunnerOutput(req_ids=[], req_id_to_index={})
|
||||
output.omni_connector_output = self.get_omni_connector_output()
|
||||
return output
|
||||
|
||||
def get_omni_connector_output(self) -> OmniConnectorOutput:
|
||||
"""Collect and reset transfer results for this execute_model cycle.
|
||||
|
||||
@@ -2088,48 +2047,6 @@ class OmniConnectorModelRunnerMixin:
|
||||
# Helpers
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
@staticmethod
|
||||
def _freeze_request_attr(value: Any) -> Any:
|
||||
if isinstance(value, list):
|
||||
return list(value)
|
||||
if isinstance(value, tuple):
|
||||
return list(value)
|
||||
if isinstance(value, torch.Tensor):
|
||||
return value.clone()
|
||||
raw_list = getattr(value, "_x", None)
|
||||
if raw_list is not None:
|
||||
return list(raw_list)
|
||||
return value
|
||||
|
||||
def _snapshot_request_for_send(self, request: Any, external_req_id: str) -> Any:
|
||||
finished = bool(getattr(request, "is_finished", lambda: False)())
|
||||
attrs: dict[str, Any] = {}
|
||||
try:
|
||||
attrs.update(vars(request))
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
for name in (
|
||||
"request_id",
|
||||
"req_id",
|
||||
"external_req_id",
|
||||
"prompt_token_ids",
|
||||
"output_token_ids",
|
||||
"all_token_ids",
|
||||
"additional_information",
|
||||
"sampling_params",
|
||||
"multi_modal_data",
|
||||
"mm_hashes",
|
||||
):
|
||||
if hasattr(request, name):
|
||||
attrs[name] = self._freeze_request_attr(getattr(request, name))
|
||||
|
||||
attrs["external_req_id"] = external_req_id
|
||||
attrs["_frozen_is_finished"] = finished
|
||||
snapshot = SimpleNamespace(**attrs)
|
||||
snapshot.is_finished = lambda: finished
|
||||
return snapshot
|
||||
|
||||
@staticmethod
|
||||
def _create_connector(model_config: Any) -> OmniConnectorBase | None:
|
||||
"""Create a connector from model_config, or None if unconfigured."""
|
||||
|
||||
Reference in new issue
Block a user