Skip to content

Commit

Permalink
Fix: change model runner arguments to support kwargs
Browse files Browse the repository at this point in the history
Signed-off-by: Dahai Tang <[email protected]>
  • Loading branch information
Dahai Tang committed Dec 12, 2024
1 parent 6f97634 commit 7a6435d
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions vllm/worker/cpu_enc_dec_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ def execute_model(
kv_caches: List[torch.Tensor],
intermediate_tensors: Optional[IntermediateTensors] = None,
num_steps: int = 1,
**kwargs: Any,
) -> Optional[List[SamplerOutput]]:
if num_steps > 1:
raise ValueError(
Expand Down
1 change: 1 addition & 0 deletions vllm/worker/cpu_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ def execute_model(
intermediate_tensors: Optional[IntermediateTensors] = None,
num_steps: int = 1,
previous_hidden_states: Optional[torch.Tensor] = None,
**kwargs,
) -> Optional[List[SamplerOutput]]:
if num_steps > 1:
raise ValueError(
Expand Down
1 change: 1 addition & 0 deletions vllm/worker/cpu_pooling_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def execute_model(
kv_caches: List[torch.Tensor],
intermediate_tensors: Optional[IntermediateTensors] = None,
num_steps: int = 1,
**kwargs: Any,
) -> Optional[Union[List[PoolerOutput], IntermediateTensors]]:
if num_steps > 1:
raise ValueError(
Expand Down
1 change: 1 addition & 0 deletions vllm/worker/enc_dec_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def execute_model(
kv_caches: List[torch.Tensor],
intermediate_tensors: Optional[IntermediateTensors] = None,
num_steps: int = 1,
**kwargs: Any,
) -> Optional[List[PoolerOutput]]:
if num_steps > 1:
raise ValueError("num_steps > 1 is not supported in "
Expand Down
1 change: 1 addition & 0 deletions vllm/worker/hpu_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1893,6 +1893,7 @@ def execute_model(
intermediate_tensors: Optional[IntermediateTensors] = None,
num_steps: int = 1,
warmup_mode=False,
**kwargs: Any,
) -> Optional[Union[List[SamplerOutput], IntermediateTensors]]:
if num_steps > 1:
raise ValueError(
Expand Down
1 change: 1 addition & 0 deletions vllm/worker/model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1617,6 +1617,7 @@ def execute_model(
num_steps: int = 1,
cache_engine: Optional["CacheEngine"] = None,
worker_input: Optional["WorkerInput"] = None,
**kwargs: Any,
) -> Optional[Union[List[SamplerOutput], IntermediateTensors]]:
if num_steps > 1:
raise ValueError("num_steps > 1 is not supported in ModelRunner")
Expand Down
1 change: 1 addition & 0 deletions vllm/worker/model_runner_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ def execute_model(
kv_caches: Optional[List[torch.Tensor]],
intermediate_tensors: Optional[IntermediateTensors],
num_steps: int = 1,
**kwargs: Any,
) -> Optional[List[SamplerOutput]]:
"""
Execute the model on the given input.
Expand Down
1 change: 1 addition & 0 deletions vllm/worker/multi_step_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ def execute_model(
kv_caches: List[torch.Tensor],
intermediate_tensors: Optional[IntermediateTensors] = None,
num_steps: int = 1,
**kwargs: Any,
) -> Optional[Union[List[SamplerOutput], IntermediateTensors]]:
"""
Execute the model for a single step and update multi-step
Expand Down
1 change: 1 addition & 0 deletions vllm/worker/neuron_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ def execute_model(
kv_caches: Optional[List[torch.Tensor]] = None,
intermediate_tensors: Optional[IntermediateTensors] = None,
num_steps: int = 1,
**kwargs: Any,
) -> Optional[List[SamplerOutput]]:
if num_steps > 1:
raise ValueError(
Expand Down
1 change: 1 addition & 0 deletions vllm/worker/openvino_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ def execute_model(
self,
seq_group_metadata_list: List[SequenceGroupMetadata],
kv_caches: List[Tuple["ov.Tensor", "ov.Tensor"]],
**kwargs: Any,

Check failure on line 330 in vllm/worker/openvino_model_runner.py

View workflow job for this annotation

GitHub Actions / ruff (3.12)

Ruff (F821)

vllm/worker/openvino_model_runner.py:330:19: F821 Undefined name `Any`

Check failure on line 330 in vllm/worker/openvino_model_runner.py

View workflow job for this annotation

GitHub Actions / mypy (3.9)

Name "Any" is not defined [name-defined]

Check failure on line 330 in vllm/worker/openvino_model_runner.py

View workflow job for this annotation

GitHub Actions / mypy (3.10)

Name "Any" is not defined [name-defined]

Check failure on line 330 in vllm/worker/openvino_model_runner.py

View workflow job for this annotation

GitHub Actions / mypy (3.11)

Name "Any" is not defined [name-defined]

Check failure on line 330 in vllm/worker/openvino_model_runner.py

View workflow job for this annotation

GitHub Actions / mypy (3.12)

Name "Any" is not defined [name-defined]
) -> Optional[SamplerOutput]:
(
input_tokens,
Expand Down
1 change: 1 addition & 0 deletions vllm/worker/pooling_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def execute_model(
kv_caches: List[torch.Tensor],
intermediate_tensors: Optional[IntermediateTensors] = None,
num_steps: int = 1,
**kwargs: Any,
) -> Optional[Union[List[PoolerOutput], IntermediateTensors]]:
if num_steps > 1:
raise ValueError(
Expand Down
1 change: 1 addition & 0 deletions vllm/worker/tpu_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ def execute_model(
kv_caches: Optional[List[Any]],
intermediate_tensors: Optional[IntermediateTensors] = None,
num_steps: int = 1,
**kwargs: Any,
) -> List[SamplerOutput]:
assert intermediate_tensors is None
if not model_input.is_first_multi_step:
Expand Down
1 change: 1 addition & 0 deletions vllm/worker/xpu_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ def execute_model(
kv_caches: List[torch.Tensor],
intermediate_tensors: Optional[IntermediateTensors] = None,
num_steps: int = 1,
**kwargs: Any,
) -> Optional[List[SamplerOutput]]:
if num_steps > 1:
raise ValueError(
Expand Down

0 comments on commit 7a6435d

Please sign in to comment.