Fix get_wikitext2 tokenization bug causing sequence length warning#2407
Open
Mr-Neutr0n wants to merge 1 commit intohuggingface:mainfrom
Open
Fix get_wikitext2 tokenization bug causing sequence length warning#2407Mr-Neutr0n wants to merge 1 commit intohuggingface:mainfrom
Mr-Neutr0n wants to merge 1 commit intohuggingface:mainfrom
Conversation
The function was concatenating up to 1000 dataset entries into a single string and tokenizing it all at once, producing a 73K+ token sequence that exceeds model maximum sequence length limits. Fix by tokenizing individual samples instead, consistent with how get_c4 and get_c4_new already work. Each sample is tokenized separately and retried if too short for the requested seqlen. Fixes huggingface#2020
Author
|
Friendly bump! Let me know if there's anything I should update or improve to help move this forward. |
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.
Summary
Fixes #2020
get_wikitext2was concatenating up to 1000 dataset entries into a single string and tokenizing it all at once. This produced a 73K+ token sequence that exceeds the model's maximum sequence length, triggering the warning:This fix changes the function to tokenize individual samples instead, consistent with how
get_c4andget_c4_newalready work. Each sample is tokenized separately and retried with a different random sample if it is shorter than the requestedseqlen.Changes
get_c4/get_c4_newpattern)Test plan
get_wikitext2(tokenizer, nsamples=128, seqlen=32, split="train")no longer produces the sequence length warning