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

Add Phi-4 to Tiktoken encoding map #7337

Open
luisquintanilla opened this issue Dec 16, 2024 · 0 comments
Open

Add Phi-4 to Tiktoken encoding map #7337

luisquintanilla opened this issue Dec 16, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request Tokenizers
Milestone

Comments

@luisquintanilla
Copy link
Contributor

Phi-4 uses Tiktoken tokenizer (100k vocab).

https://arxiv.org/pdf/[2412.08905v1](https://arxiv.org/pdf/2412.08905v1)

we now use the tiktoken tokenizer (for better multilingual support) with a padded vocabulary size of 100,352 (including unused tokens)

Consider adding it as an option to the encoding map so it's easier to create.

private static readonly (string Prefix, ModelEncoding Encoding)[] _modelPrefixToEncoding =
[
// chat
( "o1-", ModelEncoding.O200kBase ), // e.g. o1-mini
( "gpt-4o-", ModelEncoding.O200kBase), // e.g., gpt-4o-2024-05-13
( "gpt-4-", ModelEncoding.Cl100kBase), // e.g., gpt-4-0314, etc., plus gpt-4-32k
( "gpt-3.5-", ModelEncoding.Cl100kBase), // e.g, gpt-3.5-turbo-0301, -0401, etc.
( "gpt-35-", ModelEncoding.Cl100kBase ) // Azure deployment name
];
private static readonly Dictionary<string, ModelEncoding> _modelToEncoding =

@luisquintanilla luisquintanilla added the enhancement New feature or request label Dec 16, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged label Dec 16, 2024
@tarekgh tarekgh added this to the ML.NET Future milestone Dec 16, 2024
@tarekgh tarekgh added Tokenizers and removed untriaged New issue has not been triaged labels Dec 16, 2024
@tarekgh tarekgh self-assigned this Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Tokenizers
Projects
None yet
Development

No branches or pull requests

2 participants