feat: stop on generation_config's eos_token_id as well as the tokenizer's EOS #114
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/generation-config-eos"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
gllm ended a turn only on the tokenizer's single EOS id (
tokenizer_config.json'seos_token). A checkpoint'sgeneration_config.jsoncan name other ids ineos_token_id, and HFgenerateand vLLM stop on all of them. For some checkpoints the difference decides whether a reply ends at all:eos_token_idOLMo 3's chat turns end in
<|im_end|>, which its tokenizer's EOS does not name. Without this change gllm would generate past the end of every reply, writing further turns untilmax_tokens.What changes
config.Loadreadsgeneration_config.json'seos_token_id, written as one id or as a list, intoconfig.Model.StopTokenIDs.nullgives no extra ids.stopIDs): the tokenizer's EOS plus the generation-config ids. It uses every id in that set wherever it used the EOS:finish_reason: stop;reasoning_tokensfor a block that never closed.grammar.NewVocab(tok, extraStops...)treats each extra id as EOS.Effect on checkpoints already served: Granite's ids are unchanged. Nemotron 3 now also stops on
</s>, as transformers does.Verification
go build ./...,go vet ./...,go test ./...pass; gofmt is clean.TestLoadGenerationConfigcovers one id, a list (OLMo 3's shape), no field,null, no file, and two malformed files.TestGenerateStopTokenIDsruns the tiny CPU model greedily, names its third generated token as a generation-config stop, and checks that the turn ends there withfinish_reason: stop.TestExtraStopschecks that an extra stop is masked before the value starts, leaves the state unchanged when accepted, and is allowed beside EOS, and only beside EOS, once{}is complete.No GPU run: the change is in config loading and step-loop bookkeeping, covered by the CPU tests above.
🤖 Generated with Claude Code
Automated review by pr-reviewer v0.54.0 | Safety Check | Nemotron 3 Nano | tracking id
r-c1e247-2af2feThis is an AI-generated review and may contain mistakes.
Status: ❌ Failed
Review failed. Tracking id
r-c1e247-2af2fe— see logs for details.Comment
@pr-reviewer-bot retryto try again.