Skip to content

Commit ec1339c

Browse files
committed
fix mypy
Signed-off-by: Nick Hill <nhill@redhat.com>
1 parent 9cde494 commit ec1339c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

vllm/v1/engine/core.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from contextlib import ExitStack, contextmanager
1212
from inspect import isclass, signature
1313
from logging import DEBUG
14-
from typing import Any, TypeVar
14+
from typing import Any, TypeVar, cast
1515

1616
import msgspec
1717
import zmq
@@ -382,12 +382,17 @@ def step_with_batch_queue(
382382
deferred_scheduler_output = None
383383
if self.scheduler.has_requests():
384384
scheduler_output = self.scheduler.schedule()
385-
future = self.model_executor.execute_model(scheduler_output, non_block=True)
385+
exec_future = self.model_executor.execute_model(
386+
scheduler_output, non_block=True
387+
)
386388
if not self.ec_producer:
387389
model_executed = scheduler_output.total_num_scheduled_tokens > 0
388390

389-
if model_executed:
390-
future.add_done_callback(self._log_err_callback(scheduler_output))
391+
if not model_executed:
392+
# No sampling required (no requests scheduled).
393+
future = cast(Future[ModelRunnerOutput], exec_future)
394+
else:
395+
exec_future.add_done_callback(self._log_err_callback(scheduler_output))
391396

392397
if not scheduler_output.pending_structured_output_tokens:
393398
# We aren't waiting for any tokens, get any grammar output

0 commit comments

Comments
 (0)