Fix: update app for mlx-swift-lm 3.x compatibility#78
Open
tmorales2000 wants to merge 4 commits into
Open
Conversation
The mlx-swift-lm libraries (MLXLMCommon, MLXVLM) moved from mlx-swift-examples to a new repository in late 2025, breaking the app against current package versions. Package changes: - Replace mlx-swift-examples with mlx-swift-lm 3.x - Add swift-huggingface 0.9.x - Update swift-transformers to 1.3.x (exposes Tokenizers as standalone product) FastVLM.swift: - Update attention mask type to ScaledDotProductAttentionMaskMode - Fix createAttentionMask signature (windowSize parameter, single cache) - Fix LoRAModel protocol conformance (loraLayers, loraDefaultKeys) - Fix UserInput.Prompt handling (asMessages() removed in 3.x) - Fix LMInput.ProcessedImage (imageGridThw -> frames) - Fix ModelConfiguration loading API (url -> data in registry closures) - Fix register() actor isolation (async, await) - Add @preconcurrency import Tokenizers - Qualify Tokenizer as MLXLMCommon.Tokenizer to resolve ambiguity FastVLMModel.swift: - Fix MLX.GPU.set(cacheLimit:) -> MLX.Memory.cacheLimit - Fix loadContainer API (local directory + huggingFaceTokenizerLoader) - Fix generate() closure (single Int token, accumulator pattern) - Fix decode() label (tokens: -> tokenIds:) - Fix GenerateCompletionInfo (output property removed) Tested on macOS with M1 Pro, mlx-swift 0.25.6, mlx-swift-lm 3.31.3, swift-transformers 1.3.3, swift-huggingface 0.9.0.
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.
Fixes #77
The FastVLM app fails to build against current package versions due to breaking
changes in mlx-swift-lm 3.x and the migration of MLXLMCommon/MLXVLM out of
mlx-swift-examples into a new repository.
Changes
Package dependencies:
FastVLM.swift:
FastVLMModel.swift:
Scripts:
Testing
Tested on macOS with M1 Pro and M4 Pro:
App builds and runs successfully with 0.5B (FP16) and 1.5B (INT8) models.