Repository navigation
Fix handling of Sequence post-processors in train_new_from_iterator - #34246
taidopurason wants to merge 2 commits into
Conversation
|
Thanks for the issue! Also cc @itazap for knowledge (but I know your bandwidth is very limited right now) |
| post_processor[special_token] = [token, token_id] | ||
| _post_processor[special_token] = [token, token_id] | ||
|
|
||
| trained_tokenizer_json["post_processor"] = post_processor |
There was a problem hiding this comment.
Thanks for working on this!! 👍
Should this also be updated to set to _post_processors?
Also, would be great to add a test for this so that we can catch this in the future! Let me know if you would like to contribute the test or I can add it! 🤗
There was a problem hiding this comment.
Thanks for the feedback! The reason for using _post_processor on the final block is to ensure that if Roberta or BERT processors are ever part of the Sequential postprocessor, their cls and sep token IDs will be correctly updated. I can revert this if you think it’s unnecessary.
Including a unit test is a great idea - I’ll start working on it.
There was a problem hiding this comment.
Added a test case for the Sequence post-processor. @itazap, let me know what you think. Should anything else be added or changed?
|
Thanks a lot for the fix and the test! Since then, |
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_iteratorof a tokenizer with aSequencepost-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(128000instead 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?