Skip to content

Fix LlamaLanguageModel build against current llama.swift - #193

Merged
mattt merged 1 commit into
huggingface:mainfrom
james-333i:fix/llama-penalties-api
Sep 2, 2026
Merged

Fix LlamaLanguageModel build against current llama.swift#193
mattt merged 1 commit into
huggingface:mainfrom
james-333i:fix/llama-penalties-api

Conversation

@james-333i

Copy link
Copy Markdown
Contributor

Current llama.swift releases changed the signature of llama_sampler_init_penalties, which takes the vocabulary size as its first argument again. This updates the calls accordingly so the Llama trait builds. The other Llama PRs I am submitting include this commit as their base, so merging this one first collapses them to single-purpose diffs.

The open-ended dependency range resolves llama.swift to releases
wrapping current llama.cpp builds, where the Llama trait no longer
compiles: llama_sampler_init_penalties regained its leading n_vocab
parameter, and llama_model_params replaced use_mmap and use_mlock
with a llama_load_mode enum.

Pass the vocabulary size at all three penalties call sites and set
load_mode to LLAMA_LOAD_MODE_MMAP, matching the previous mmap-only
behavior. Verified against llama.swift 2.10549.0 with the full live
test suite.
@mattt

mattt commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Merging now. Thanks, @james-333i!

@mattt
mattt merged commit d822848 into huggingface:main Sep 2, 2026
@mattt

mattt commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Hi @james-333i. Thank you for all of these. Porting the fixes back from your fork is exactly the kind of help this project needed, and I'm sorry they sat for a week without CI even running. main had two problems that failed every PR (a lint break and this llama.swift build break), so with this merged and the lint fixed, CI is green again.

I've merged #199, #201, #202, and #204 after verifying them locally. #200 picked up a conflict with #199 in OllamaLanguageModel.swift; would you rebase it? Next I'll go through #196 -> #195 -> #194 -> #197 -> #205. Since those include this PR's commit, the squash-merge should sort out the overlap, so no need to rebase unless GitHub reports a conflict. I left a one-line fix on #205, and I have a question each on #198 and #206.

mattt added a commit that referenced this pull request Sep 2, 2026
The macOS legs build with the MLX, Llama, and CoreML traits and take 6-8
minutes on a cold cache. The first green run on main after #193/#207 had
one job cancelled at the 10-minute limit while saving the SwiftPM cache,
after Lint, Build, and Test had all passed. Because the save is cut off,
the cache never populates and every run stays cold.
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