Fix handling of Sequence post-processors in train_new_from_iterator #34246
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.
What does this PR do?
This PR fixes an issue where the post-processor special token IDs are not correctly updated when training a new tokenizer using
train_new_from_iterator
of a tokenizer with aSequence
post-processor. Instead, the special token IDs are copied directly from the original tokenizer.For example, this affects training a new tokenizer from Llama-3 tokenizers, as reported in #33998 and #30752.
Running the following code:
the output is:
As shown, the new tokenizer prepends an incorrect
bos_token_id
(128000
instead of0
)Fixes #33998 #30752
I welcome feedback and suggestions on this fix.
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?