From 363aaeef0ff8511fd1466d41a2e027b22b28f39b Mon Sep 17 00:00:00 2001 From: Mohammad Othman <48595863+OthmanMohammad@users.noreply.github.com> Date: Sat, 15 Nov 2025 06:31:36 +0200 Subject: [PATCH] Fix IntermediateTensors initialization and add type hints (#28743) Signed-off-by: Mohammad Othman Co-authored-by: Mohammad Othman --- vllm/sequence.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vllm/sequence.py b/vllm/sequence.py index 6bcc94ad5c625..6d20ca9aac225 100644 --- a/vllm/sequence.py +++ b/vllm/sequence.py @@ -60,12 +60,17 @@ class IntermediateTensors: tensors: dict[str, torch.Tensor] kv_connector_output: KVConnectorOutput | None - def __init__(self, tensors): + def __init__( + self, + tensors: dict[str, torch.Tensor], + kv_connector_output: KVConnectorOutput | None = None, + ) -> None: # manually define this function, so that # Dynamo knows `IntermediateTensors()` comes from this file. # Otherwise, dataclass will generate this function by evaluating # a string, and we will lose the information about the source file. self.tensors = tensors + self.kv_connector_output = kv_connector_output def __getitem__(self, key: str | slice): if isinstance(key, str):