fix(calibration): interpolate the item index in the unsupported-sequence error - #3017
Open
Anai-Guo wants to merge 1 commit into
Open
fix(calibration): interpolate the item index in the unsupported-sequence error#3017Anai-Guo wants to merge 1 commit into
Anai-Guo wants to merge 1 commit into
Conversation
…nce error
The sibling raises in _tokenize_messages_value are f-strings; this one is not,
so it reports a literal {idx} instead of the calibration item number.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In
prepare_calibration_dataset, the helper_tokenize_messages_valueraises threeValueErrors that all report which calibration item failed. Two of them are f-strings;the middle one is a plain string literal, so its
{idx}is emitted verbatim:gptqmodel/utils/calibration.pyRendering the two literals with
idx = 3:The index is the only actionable part of the message — it is what tells the user which
row of their calibration dataset to look at. This branch fires when a custom
apply_templatereturns a non-empty sequence whose first element is not anint(e.g. a list of token strings), and the user is left without the item number.
Neither ruff nor flake8 flags this:
F541covers f-strings with no placeholders, notthe reverse.
Fix
Add the missing
fprefix. One character, no behaviour change beyond the message text.Note on
AGENTS.mdAGENTS.mdroutes tokenizer/chat-template behaviour changes to Tokenicer. This patchchanges no tokenization, prompt rendering, or normalization logic — it only makes an
existing diagnostic interpolate the value it already names — so it stays in
GPT-QModel.
🤖 Generated with Claude Code