[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:
co-authored by
Claude
Hui Li
parent
ad8a6065f4
commit
04462732a4
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user