[V1][Easy] Add empty allowed_token_ids in the v1 sampler test (#14308)

Signed-off-by: Lu Fang <lufang@fb.com>
This commit is contained in:
Lu Fang 2025-03-05 13:41:18 -08:00 committed by GitHub
parent 1b7624bf5c
commit 53ea6ad830
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -113,6 +113,10 @@ def test_allowed_token_ids(model):
PROMPT, SamplingParams(allowed_token_ids=allowed_token_ids))
assert output[0].outputs[0].token_ids[-1] == TOKEN_ID
# Reject empty allowed_token_ids.
with pytest.raises(ValueError):
_ = model.generate(PROMPT, SamplingParams(allowed_token_ids=[]))
# Reject negative token id.
with pytest.raises(ValueError):
_ = model.generate(PROMPT, SamplingParams(allowed_token_ids=[-1]))