Skip to content

Commit df11d0c

Browse files
committed
SchedulerConfig should own its default factory
Signed-off-by: Harry Mellor <[email protected]>
1 parent b23329e commit df11d0c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

vllm/config/scheduler.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,13 @@ class SchedulerConfig:
141141
while a larger value (e.g., 10) reduces host overhead and may increase throughput
142142
by batching multiple tokens before sending."""
143143

144+
@staticmethod
145+
def default_factory():
146+
"""
147+
Factory method to create `SchedulerConfig` with default values for `InitVar`s.
148+
"""
149+
return SchedulerConfig(max_model_len=8192, is_encoder_decoder=False)
150+
144151
def get_scheduler_cls(self) -> type["SchedulerInterface"]:
145152
if self.scheduler_cls is None:
146153
if self.async_scheduling:

vllm/config/vllm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,6 @@ def enable_fusion(cfg: "VllmConfig") -> bool:
154154
OptimizationLevel.O3: OPTIMIZATION_LEVEL_03,
155155
}
156156

157-
SCHEDULER_CONFIG_FACTORY = lambda: SchedulerConfig(8192, False)
158-
159157

160158
@config
161159
@dataclass(config=ConfigDict(arbitrary_types_allowed=True))
@@ -172,7 +170,9 @@ class VllmConfig:
172170
"""Cache configuration."""
173171
parallel_config: ParallelConfig = Field(default_factory=ParallelConfig)
174172
"""Parallel configuration."""
175-
scheduler_config: SchedulerConfig = Field(default_factory=SCHEDULER_CONFIG_FACTORY)
173+
scheduler_config: SchedulerConfig = Field(
174+
default_factory=SchedulerConfig.default_factory,
175+
)
176176
"""Scheduler configuration."""
177177
device_config: DeviceConfig = Field(default_factory=DeviceConfig)
178178
"""Device configuration."""

0 commit comments

Comments
 (0)