Skip to content

Commit a35720f

Browse files
author
Mu Huai
committed
fix:pre commit
Signed-off-by: Mu Huai <tianbowen.tbw@antgroup.com>
1 parent 5e8565a commit a35720f

File tree

4 files changed

+112
-111
lines changed

4 files changed

+112
-111
lines changed

vllm/v1/core/sched/scheduler.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@
3838
class Scheduler(SchedulerInterface):
3939

4040
def __init__(
41-
self,
42-
vllm_config: VllmConfig,
43-
kv_cache_config: KVCacheConfig,
44-
structured_output_manager: StructuredOutputManager,
45-
mm_registry: MultiModalRegistry = MULTIMODAL_REGISTRY,
46-
include_finished_set: bool = False,
47-
log_stats: bool = False,
41+
self,
42+
vllm_config: VllmConfig,
43+
kv_cache_config: KVCacheConfig,
44+
structured_output_manager: StructuredOutputManager,
45+
mm_registry: MultiModalRegistry = MULTIMODAL_REGISTRY,
46+
include_finished_set: bool = False,
47+
log_stats: bool = False,
4848
) -> None:
4949
self.vllm_config = vllm_config
5050
self.scheduler_config = vllm_config.scheduler_config
@@ -68,8 +68,8 @@ def __init__(
6868
self.scheduler_config.max_num_batched_tokens
6969
self.max_model_len = self.scheduler_config.max_model_len
7070
self.enable_kv_cache_events = (
71-
self.kv_events_config is not None
72-
and self.kv_events_config.enable_kv_cache_events)
71+
self.kv_events_config is not None
72+
and self.kv_events_config.enable_kv_cache_events)
7373

7474
# Create KVConnector for the Scheduler. Note that each Worker
7575
# will have a corresponding KVConnector with Role=WORKER.
@@ -214,8 +214,8 @@ def schedule(self) -> SchedulerOutput:
214214
if request.has_encoder_inputs:
215215
(encoder_inputs_to_schedule, num_new_tokens,
216216
new_encoder_budget) = self._try_schedule_encoder_inputs(
217-
request, request.num_computed_tokens, num_new_tokens,
218-
encoder_budget)
217+
request, request.num_computed_tokens, num_new_tokens,
218+
encoder_budget)
219219

220220
if num_new_tokens == 0:
221221
# The request cannot be scheduled because one of the following
@@ -592,7 +592,7 @@ def _make_cached_request_data(
592592
num_computed_tokens = request.num_computed_tokens
593593
num_regular_tokens = num_scheduled_tokens - num_scheduled_spec_tokens
594594
new_token_ids = request.all_token_ids[
595-
num_computed_tokens:num_computed_tokens + num_regular_tokens]
595+
num_computed_tokens:num_computed_tokens + num_regular_tokens]
596596

597597
req_data_queue = self._cached_reqs_data.get(request.request_id)
598598
if req_data_queue:
@@ -611,11 +611,11 @@ def _make_cached_request_data(
611611
return req_data
612612

613613
def _try_schedule_encoder_inputs(
614-
self,
615-
request: Request,
616-
num_computed_tokens: int,
617-
num_new_tokens: int,
618-
encoder_budget: int,
614+
self,
615+
request: Request,
616+
num_computed_tokens: int,
617+
num_new_tokens: int,
618+
encoder_budget: int,
619619
) -> tuple[list[int], int, int]:
620620
"""
621621
Determine which encoder inputs need to be scheduled in the current step,
@@ -810,7 +810,7 @@ def update_from_output(
810810
new_prompt_logprobs_tensors=prompt_logprobs_tensors,
811811
stop_reason=request.stop_reason,
812812
events=request.take_events(),
813-
kv_transfer_params = kv_transfer_params,
813+
kv_transfer_params=kv_transfer_params,
814814
trace_headers=request.trace_headers,
815815
num_cached_tokens=request.num_cached_tokens,
816816
))
@@ -871,9 +871,9 @@ def add_request(self, request: Request) -> None:
871871
request.record_event(EngineCoreEventType.QUEUED)
872872

873873
def finish_requests(
874-
self,
875-
request_ids: Union[str, Iterable[str]],
876-
finished_status: RequestStatus,
874+
self,
875+
request_ids: Union[str, Iterable[str]],
876+
finished_status: RequestStatus,
877877
) -> None:
878878
"""Handles the finish signal from outside the scheduler.
879879
@@ -882,7 +882,7 @@ def finish_requests(
882882
"""
883883
assert RequestStatus.is_finished(finished_status)
884884
if isinstance(request_ids, str):
885-
request_ids = (request_ids,)
885+
request_ids = (request_ids, )
886886
else:
887887
request_ids = set(request_ids)
888888

@@ -933,8 +933,8 @@ def reset_prefix_cache(self) -> bool:
933933
return self.kv_cache_manager.reset_prefix_cache()
934934

935935
def make_stats(
936-
self,
937-
spec_decoding_stats: Optional[SpecDecodingStats] = None,
936+
self,
937+
spec_decoding_stats: Optional[SpecDecodingStats] = None,
938938
) -> Optional[SchedulerStats]:
939939
if not self.log_stats:
940940
return None
@@ -949,10 +949,10 @@ def make_stats(
949949
)
950950

951951
def make_spec_decoding_stats(
952-
self,
953-
spec_decoding_stats: Optional[SpecDecodingStats],
954-
num_draft_tokens: int,
955-
num_accepted_tokens: int,
952+
self,
953+
spec_decoding_stats: Optional[SpecDecodingStats],
954+
num_draft_tokens: int,
955+
num_accepted_tokens: int,
956956
) -> Optional[SpecDecodingStats]:
957957
if not self.log_stats:
958958
return None

vllm/v1/engine/__init__.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import enum
55
import time
6-
from collections.abc import Sequence
7-
from typing import Any, Optional, Union, Mapping
6+
from collections.abc import Mapping, Sequence
7+
from typing import Any, Optional, Union
88

99
import msgspec
1010

@@ -40,10 +40,10 @@ def __str__(self):
4040

4141

4242
class EngineCoreRequest(
43-
msgspec.Struct,
44-
array_like=True, # type: ignore[call-arg]
45-
omit_defaults=True, # type: ignore[call-arg]
46-
gc=False): # type: ignore[call-arg]
43+
msgspec.Struct,
44+
array_like=True, # type: ignore[call-arg]
45+
omit_defaults=True, # type: ignore[call-arg]
46+
gc=False): # type: ignore[call-arg]
4747

4848
request_id: str
4949
prompt_token_ids: list[int]
@@ -95,10 +95,10 @@ def new_event(cls,
9595

9696

9797
class EngineCoreOutput(
98-
msgspec.Struct,
99-
array_like=True, # type: ignore[call-arg]
100-
omit_defaults=True, # type: ignore[call-arg]
101-
gc=False): # type: ignore[call-arg]
98+
msgspec.Struct,
99+
array_like=True, # type: ignore[call-arg]
100+
omit_defaults=True, # type: ignore[call-arg]
101+
gc=False): # type: ignore[call-arg]
102102

103103
request_id: str
104104
new_token_ids: list[int]
@@ -110,7 +110,7 @@ class EngineCoreOutput(
110110
stop_reason: Union[int, str, None] = None
111111
events: Optional[list[EngineCoreEvent]] = None
112112
kv_transfer_params: Optional[dict[str, Any]] = None
113-
113+
114114
trace_headers: Optional[Mapping[str, str]] = None
115115
# The number of tokens with prefix cache hits.
116116
num_cached_tokens: int = 0
@@ -121,9 +121,9 @@ def finished(self) -> bool:
121121

122122

123123
class UtilityOutput(
124-
msgspec.Struct,
125-
array_like=True, # type: ignore[call-arg]
126-
gc=False): # type: ignore[call-arg]
124+
msgspec.Struct,
125+
array_like=True, # type: ignore[call-arg]
126+
gc=False): # type: ignore[call-arg]
127127

128128
call_id: int
129129

@@ -133,10 +133,10 @@ class UtilityOutput(
133133

134134

135135
class EngineCoreOutputs(
136-
msgspec.Struct,
137-
array_like=True, # type: ignore[call-arg]
138-
omit_defaults=True, # type: ignore[call-arg]
139-
gc=False): # type: ignore[call-arg]
136+
msgspec.Struct,
137+
array_like=True, # type: ignore[call-arg]
138+
omit_defaults=True, # type: ignore[call-arg]
139+
gc=False): # type: ignore[call-arg]
140140

141141
# NOTE(Nick): We could consider ways to make this more compact,
142142
# e.g. columnwise layout

0 commit comments

Comments
 (0)