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

Public tokenizer errors, hasChatTemplate #171

Merged
merged 2 commits into from
Jan 31, 2025
Merged

Public tokenizer errors, hasChatTemplate #171

merged 2 commits into from
Jan 31, 2025

Conversation

pcuenca
Copy link
Member

@pcuenca pcuenca commented Jan 31, 2025

See ml-explore/mlx-swift-examples#181 (comment), ml-explore/mlx-swift-examples#150

In addition to making the tokenizer errors public, this PR adds a new hasChatTemplate property. We could also create an accessor for the chat template itself if needed, but we still need to support array values that are in the process of being deprecated anyway.

Would these changes suffice for mlx-swift, @davidkoski? Do you think we'd need something like Python's tokenize=False argument, like @awni mentioned?

@davidkoski
Copy link
Contributor

Would tokenize=False be a method that just applied the template and returned the string? The only thing I can think we need it for today is if somebody wanted to log it for debug purposes -- perhaps the llmtool would call it and log it.

Right now the only problem I know of is the caller not knowing if they can safely call the applyChatTemplate method itself, so public error and hasChatTemplate seems sufficient.

@pcuenca
Copy link
Member Author

pcuenca commented Jan 31, 2025

Yes, I think there are interesting use cases for tokenize=False, I've seen people decoding the ids as a workaround.

I'll merge this then and we can incorporate tokenize=False later. Thank you!

@pcuenca pcuenca merged commit 55710dd into main Jan 31, 2025
1 check passed
@pcuenca pcuenca deleted the template-helpers branch January 31, 2025 15:39
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