[Bugfix][Model Runner V2] Preserve all allowed_token_ids in the logit bias kernel (#46245)
Signed-off-by: Ting Sun <suntcrick@gmail.com>
This commit is contained in:
@@ -152,6 +152,14 @@ def test_allowed_token_ids(llm):
|
||||
output = llm.generate(PROMPT, SamplingParams(allowed_token_ids=allowed_token_ids))
|
||||
assert output[0].outputs[0].token_ids[-1] == TOKEN_ID
|
||||
|
||||
# Each single-token allowlist must force that token (kernel used to drop some).
|
||||
for token_id in (1, 5, 100, 500, 2518, 9834, 31999):
|
||||
output = llm.generate(
|
||||
PROMPT,
|
||||
SamplingParams(temperature=0, max_tokens=1, allowed_token_ids=[token_id]),
|
||||
)
|
||||
assert output[0].outputs[0].token_ids[-1] == token_id
|
||||
|
||||
# Reject empty allowed_token_ids.
|
||||
with pytest.raises(ValueError):
|
||||
_ = llm.generate(PROMPT, SamplingParams(allowed_token_ids=[]))
|
||||
|
||||
Reference in New Issue
Block a user