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

Simplify byte_pair_merge #17

Merged
merged 1 commit into from
Oct 17, 2024
Merged

Simplify byte_pair_merge #17

merged 1 commit into from
Oct 17, 2024

Conversation

tmm1
Copy link

@tmm1 tmm1 commented Oct 17, 2024

backport of openai#255

Based on suggestion in openai#239
(specifically openai/tiktoken@8f5dd7d)

Like that commit, this:
- Does the init in a single loop and saves a loop if there are no merges
- Simplifies get_rank and no longer uses it in init (so you don't need
multiple skip values)

Unlike that commit:
- We drop optimisations enabled by ignoring single tokens. These didn't
show any benefit on benchmarks for me (this makes sense given typical
piece sizes, but let me know if that's unexpected!). Given this, I opted
for the simpler version.
- I preserve some of the comments from the original that I think are
still useful

Co-authored-by: @paplorinc

---------

Co-authored-by: Lőrinc Pap <1841944+paplorinc@users.noreply.github.com>
@tmm1 tmm1 merged commit 0a951f9 into main Oct 17, 2024
1 check 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.

2 participants