Skip to content

LocalLLMClientMLX: missing 'Tokenizers' module after mlx-swift-lm decoupling #93

@gsdali

Description

@gsdali

Summary

LocalLLMClientMLX fails to build against current mlx-swift-lm main because
its source imports Tokenizers (from swift-transformers), but
mlx-swift-lm decoupled from swift-transformers in
ml-explore/mlx-swift-lm#118
on 2026-04-01. The Tokenizers module is no longer transitively available.

Repro

Consume LocalLLMClient main + LocalLLMClientMLX from a Swift 6 package:

.package(url: "https://github.com/tattn/LocalLLMClient.git", revision: "<main HEAD>"),

.target(
    name: "MyTarget",
    dependencies: [
        .product(name: "LocalLLMClient", package: "LocalLLMClient"),
        .product(name: "LocalLLMClientMLX", package: "LocalLLMClient"),
    ]
),

swift build

error: no such module 'Tokenizers'
.build/checkouts/LocalLLMClient/Sources/LocalLLMClientMLX/Context.swift:7:8
  5 | import MLXLLM
  6 | import MLXLMCommon
  7 | import Tokenizers
    |        `- error: no such module 'Tokenizers'

Same error in LocalLLMClientMLX/MLXClient.swift and
LocalLLMClientMLX/LLMSession+MLX.swift.

Fix

Add swift-transformers as a direct package dependency for LocalLLMClientMLX:

// Package.swift
.package(url: "https://github.com/huggingface/swift-transformers.git", from: "1.3.0"),

// LocalLLMClientMLX target dependencies:
.product(name: "Tokenizers", package: "swift-transformers"),

swift-transformers 1.3.0 (2026-03-23) provides the Tokenizers library
target directly.

Context

Filed while wiring LocalLLMClient into OCCTSwiftPartsAgent (in-process
on-device parser path). Shipped 0.4.6 still works against older
mlx-swift-lm tags, but adopters who pin LocalLLMClient by branch/revision
(forced by the SPM unstable-version rule, since 0.4.6 declares mlx-swift-lm
via branch: "main") get current mlx-swift-lm and hit this break.

Pairs with the Llama backend C++ stdlib issue (filed separately) — together
they leave LocalLLMClient unable to deliver any local-inference backend on
current main.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions