Update mlx-swift-lm to support Gemma 4#154
Open
mbarnach wants to merge 2 commits into
Open
Conversation
Add HuggingFace support and a tokenizer bridge for MLX models. Imports HuggingFace and implements HubClientDownloader to fetch model snapshots via HubClient. Introduces LocalTokenizersLoader and TokenizerBridge to adapt Tokenizers.AutoTokenizer to MLXLMCommon.Tokenizer (including chat template error mapping). Update model loading calls to use the new downloader/tokenizer loader and adjust MLXTokenBackend and related APIs to use MLXLMCommon.Tokenizer and the renamed decode parameter (tokenIds). These changes enable loading models from the Hugging Face Hub and local directories with compatible tokenizer behavior.
Contributor
|
@mattt pls take a look, would good to have latest changes from mlx-swift-lm. Thanks! |
pcuenca
reviewed
May 26, 2026
Member
pcuenca
left a comment
There was a problem hiding this comment.
Hi @mbarnach sorry for the delay. I think the direction is good, but this PR doesn't build for me when the MLX trait is enabled.
I'll investigate a bit to recommend the best direction forward; we can work together on it if you're still interested.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update the MLX-SWIFT-LM dependency to add the support for Gemma 4 model.
Not so sure about the intermediate wrapper, but open to suggestions :-)