[Rebase] Align vLLM-Omni with vLLM v0.31.0 (#8459)
Signed-off-by: tzhouam <tzhouam@connect.ust.hk>
This commit is contained in:
1 parent
1f47fa2f29
commit
0b0d2d7009
141 files changed
+2885
-721
No files matched your search
@@ -41,6 +41,7 @@ if TYPE_CHECKING:
|
||||
from vllm.tokenizers import TokenizerLike
|
||||
from vllm.v1.engine import PauseMode
|
||||
from vllm.v1.engine.input_processor import InputProcessor
|
||||
from vllm.v1.kv_hints import KvHintsEnvelope
|
||||
|
||||
from vllm_omni.inputs.data import OmniInteractionPrompt, OmniPromptType
|
||||
|
||||
@@ -125,6 +126,7 @@ class AsyncOmni(AsyncOmniBase, EngineClient):
|
||||
priority: int = 0,
|
||||
data_parallel_rank: int | None = None,
|
||||
session_id: str | None = None,
|
||||
kv_hints: KvHintsEnvelope | None = None,
|
||||
reasoning_ended: bool | None = None,
|
||||
reasoning_parser_kwargs: dict[str, Any] | None = None,
|
||||
arrival_time: float | None = None,
|
||||
@@ -278,6 +280,7 @@ class AsyncOmni(AsyncOmniBase, EngineClient):
|
||||
arrival_time=wall_start_ts,
|
||||
lora_request=lora_request,
|
||||
first_chunk_submitted=first_chunk_submitted,
|
||||
**({"kv_hints": kv_hints} if kv_hints is not None else {}),
|
||||
)
|
||||
await first_chunk_submitted
|
||||
else:
|
||||
@@ -289,6 +292,7 @@ class AsyncOmni(AsyncOmniBase, EngineClient):
|
||||
final_output_stage_ids=final_output_stage_ids,
|
||||
arrival_time=wall_start_ts,
|
||||
lora_request=lora_request,
|
||||
**({"kv_hints": kv_hints} if kv_hints is not None else {}),
|
||||
)
|
||||
submit_ts = time.time()
|
||||
stage_first_ts = cast(list[float | None], req_state.metrics.stage_first_ts)
|
||||
@@ -365,6 +369,7 @@ class AsyncOmni(AsyncOmniBase, EngineClient):
|
||||
arrival_time: float,
|
||||
lora_request: Any = None,
|
||||
first_chunk_submitted: asyncio.Future[None] | None = None,
|
||||
kv_hints: KvHintsEnvelope | None = None,
|
||||
) -> asyncio.Task:
|
||||
"""Submit a streaming input generator as incremental stage-0 updates."""
|
||||
if not sampling_params_list:
|
||||
@@ -426,6 +431,7 @@ class AsyncOmni(AsyncOmniBase, EngineClient):
|
||||
arrival_time=arrival_time,
|
||||
lora_request=lora_request,
|
||||
resumable=True,
|
||||
**({"kv_hints": kv_hints} if kv_hints is not None else {}),
|
||||
)
|
||||
)
|
||||
has_submitted_first_chunk = True
|
||||
@@ -483,6 +489,7 @@ class AsyncOmni(AsyncOmniBase, EngineClient):
|
||||
arrival_time=arrival_time,
|
||||
lora_request=lora_request,
|
||||
resumable=False,
|
||||
**({"kv_hints": kv_hints} if kv_hints is not None else {}),
|
||||
)
|
||||
)
|
||||
has_submitted_first_chunk = True
|
||||
@@ -907,6 +914,28 @@ class AsyncOmni(AsyncOmniBase, EngineClient):
|
||||
)
|
||||
return all(self._coerce_stage_bool(result) for result in results)
|
||||
|
||||
async def release_kv_cache_memory(
|
||||
self, *, stage_ids: list[int] | None = None, timeout: float = CACHE_RESET_TIMEOUT_S
|
||||
) -> None:
|
||||
"""Discard AR-stage KV memory after a completed generation pause.
|
||||
|
||||
EngineCore checks that the scheduler is paused and all executor
|
||||
memory is resident. Diffusion stages have no KV cache to release.
|
||||
Restore KV memory with ``wake_up(tags=["kv_cache"])`` before resuming.
|
||||
"""
|
||||
ar_stage_ids, _ = self._split_stage_ids_by_type(stage_ids)
|
||||
if not ar_stage_ids:
|
||||
return
|
||||
async with self._pause_cond:
|
||||
if not self._paused:
|
||||
raise RuntimeError("release_kv_cache_memory() requires a completed pause first")
|
||||
await self._pause_cond.wait_for(lambda: getattr(self, "_admitting", 0) == 0)
|
||||
if 0 in ar_stage_ids:
|
||||
await asyncio.wait_for(self._clear_frontend_mm_cache(), timeout=timeout)
|
||||
await self._engine_core_rpc("release_kv_cache_memory", stage_ids=ar_stage_ids, timeout=timeout)
|
||||
self._record_stage_sleep(ar_stage_ids, [CuMemTag.KV_CACHE.value])
|
||||
self._hold_admission_until_resume = True
|
||||
|
||||
async def sleep(
|
||||
self, stage_ids: list[int] | None = None, level: int = 2, mode: PauseMode = "abort"
|
||||
) -> list[OmniACK]:
|
||||
|
||||
Reference in new issue
Block a user