[Bugfix] Reject max_num_scheduled_tokens=0 at config time instead of hanging (#60714)

Signed-off-by: Vadim Gimpelson <vadim.gimpelson@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Hui Li <40770106+untrall@users.noreply.github.com>
This commit is contained in:
Vadim Gimpelson
2026-10-09 19:15:10 +00:00
committed by GitHub
co-authored by Claude Hui Li
parent ad8a6065f4
commit 04462732a4
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -3486,6 +3486,12 @@ def test_scheduler_config_init():
print(SchedulerConfig.default_factory().max_model_len)
def test_scheduler_config_rejects_zero_max_num_scheduled_tokens():
"""A zero token budget never schedules anything, so generation would hang."""
with pytest.raises(ValidationError, match="max_num_scheduled_tokens"):
SchedulerConfig.default_factory(max_num_scheduled_tokens=0)
@pytest.mark.parametrize(
(
"model_id",
+1 -1
View File
@@ -52,7 +52,7 @@ class SchedulerConfig:
In real usage, this should be set in `EngineArgs.create_engine_config`.
"""
max_num_scheduled_tokens: int | None = Field(default=None, ge=0)
max_num_scheduled_tokens: int | None = Field(default=None, ge=1)
"""Maximum number of tokens that the scheduler may issue in a single iteration.
This is usually equal to max_num_batched_tokens, but can be smaller in cases