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

added q75 BPE #199

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

added q75 BPE #199

wants to merge 1 commit into from

Conversation

KushGrandhi
Copy link

Byte Pair Encoding (BPE) for Subword Tokenization

Problem Statement:
Design and implement an algorithm to tokenize a given corpus into subword units based on the frequency of adjacent character pairs using the Byte Pair Encoding (BPE) method. The algorithm should iteratively merge the most frequent character pairs in the corpus to create a compact and meaningful token vocabulary.

The task is to implement BPE by:

Iteratively finding and merging the most frequent pairs of adjacent characters or subwords.
Updating the corpus and token vocabulary after each merge.
Continuing the process until a stopping criterion is reached (e.g., a fixed number of merges or achieving a desired vocabulary size).


return bpe_rules, vocab, separate_tokens

# Example usage
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you be able to add some tests to this solution

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.

2 participants