Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract pre-tokenization out of tokenization models #441

Merged
merged 7 commits into from
Dec 4, 2024

Conversation

robertknight
Copy link
Owner

@robertknight robertknight commented Dec 4, 2024

As part of #427, extract the input splitting logic out of the WordPiece and Bpe tokenization models and make it a separate pre-tokenization step in the pipeline executed by Tokenizer.

TODO:

  • Decide on pre_tokenizer vs pretokenizer in naming
  • Parse pretokenizer field from tokenizer.json files, for already-supported pre-tokenizers
  • Refactor away duplication in tokenization pipeline for the first and second sequences in a pair

This will be useful for getting the offsets of subslices yielded by
pre-tokenization of the normalized input.
Move the regex splitting pre-tokenization out of the BPE model and into a
separate pipeline step called by `Tokenizer` after normalization. This makes
this pre-tokenization method usable with other tokenization models and is part
of aligning the tokenization pipeline in rten-text with Hugging Face Tokenizers.
Align with the naming convention in the tokenizers crate.
@robertknight robertknight force-pushed the byte-level-pre-tokenizer branch from a69e7dc to d49d6b2 Compare December 4, 2024 20:04
This is now subsumed by `TokenizerError::PreTokenizeFailed`.
@robertknight robertknight marked this pull request as ready for review December 4, 2024 20:57
@robertknight robertknight merged commit d51994e into main Dec 4, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant