Skip to content

Bump mlx-swift-lm to 3.x (3.31.3)#161

Open
noorbhatia wants to merge 1 commit into
huggingface:mainfrom
noorbhatia:noor/mlx-swift-bump
Open

Bump mlx-swift-lm to 3.x (3.31.3)#161
noorbhatia wants to merge 1 commit into
huggingface:mainfrom
noorbhatia:noor/mlx-swift-bump

Conversation

@noorbhatia
Copy link
Copy Markdown
Contributor

@noorbhatia noorbhatia commented Jun 3, 2026

Resolves #157

mlx-swift-lm 3.x decouples MLXLMCommon from the Hugging Face Hub and
swift-transformers' tokenizer: it now defines its own Tokenizer,
Downloader, and TokenizerLoader protocols, and consumers must supply
concrete implementations. Adopt the in-repo MLXHuggingFace macros to
restore Hub-based loading with minimal churn, keeping the existing
ModelContext-based backend intact.

Package.swift:

  • Bump mlx-swift-lm to from: "3.0.0" (resolves 3.31.3; pulls mlx-swift
    0.31.x).
  • Add swift-huggingface (0.9.0) dependency.
  • Add MLX-trait products: MLXHuggingFace (macros), HuggingFace
    (HubClient), and swift-transformers' Tokenizers (AutoTokenizer).

MLXLanguageModel.swift:

  • Drop import Hub; add MLXLLM, MLXHuggingFace, HuggingFace imports.
    MLXLLM is now imported so MLXLLM.TrampolineModelFactory is linked
    alongside MLXVLM's for ModelFactoryRegistry resolution.
  • Replace the removed loadModel(hub:id:) / loadModel(directory:) with
    the 3.x loadModel(from:using:id:) / loadModel(from:using:), expanding
    the #hubDownloader() and #huggingFaceTokenizerLoader() macros.
  • Rename Tokenizer.decode(tokens:) -> decode(tokenIds:) (3 sites) and
    qualify any Tokenizer -> any MLXLMCommon.Tokenizer to disambiguate
    from Tokenizers.Tokenizer.

BREAKING (MLX trait only): MLXLanguageModel.hub and its hub: init
parameter change from HubApi? to HubClient?. Code passing or reading a
custom hub must switch import Hub + HubApi(...) to import HuggingFace

  • HubClient(...). MLXLanguageModel(modelId:) and other default
    constructions are unaffected; non-MLX consumers see no change.

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.

Bump mlx-swift-lm / mlx-swift

1 participant