Skip to content

Conversation

@hendrikvanantwerpen
Copy link
Contributor

No description provided.

@hendrikvanantwerpen hendrikvanantwerpen self-assigned this Sep 24, 2024
Comment on lines 208 to 210
if let Some(j) = bytes_hash_to_token.insert(hash_bytes(&token), i as u32) {
eprintln!("collision: ({i}, {j})");
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

should the function return an error instead when this happens?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If this happens, the assertion below the loop will fail. I wonder if we want to provide a way to specify the factor as part of the API, if anyone wants to construct a BPE from their own dictionary. The hard-coded constant might make it harder to reuse this if users bring their own tokens. But I'll save that for a follow-up PR.

/// 3. Run [`update_token_dicts`] tests below to update data files.
#[test]
#[ignore = "run manually to find a suitable hash factor"]
fn find_hash_factor() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

:)

// TODO: Move the generation of the dictionary into some build procedure?
#[test]
fn test_serialize() {
#[ignore = "run manually to update data files"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

in principle, we could let this test run normally, since it will fix the broken data file (and one will see in the diff that something has changed)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, let's do that.

Copy link
Collaborator

@aneubeck aneubeck left a comment

Choose a reason for hiding this comment

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

What are the benchmark numbers for o200k?
Did things get slower?

@hendrikvanantwerpen
Copy link
Contributor Author

What are the benchmark numbers for o200k?
Did things get slower?

Performance characteristics look similar.

cl100k

image

o200k

image

@hendrikvanantwerpen hendrikvanantwerpen merged commit 3a14632 into main Sep 25, 2024
@hendrikvanantwerpen hendrikvanantwerpen deleted the add-o200k-tokens branch September 25, 2024 12:09
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