Skip to content

[Other] setup (Mac): Swift 1.5 IQ3_S, opt-in with --family swift - #3537

Draft
oceanio wants to merge 2 commits into
Niko1221:mainfrom
oceanio:feat/mac-swift
Draft

oceanio wants to merge 2 commits into
Niko1221:mainfrom
oceanio:feat/mac-swift

Conversation

@oceanio

@oceanio oceanio commented Oct 21, 2026 •

Copy link
Copy Markdown

Problem and result

On a Mac, ./setup.sh sets up the original Qwen3.8-Flash-Next, Unsloth's UD files and agentionai's Gyro files only;
docs/MAC.md says "The Swift and Coder releases are not set up on Mac yet". Swift 1.5 itself runs on the Metal engine,
but setup cannot prepare it: its two shards cut through a layer (IQ3_S: layer 14's gate in shard 1, its up and down in shard 2), shard 1 also holds
the n-gram table, and the Metal engine maps one file.

With this PR, ./setup.sh --family swift downloads Swift 1.5 IQ3_S, repacks its shards into one GGUF with the existing
metal/tools/metal_repack.py (as setup already does for Unsloth's files), builds the pack and writes a config. Without
--family swift nothing changes: the size menu, the original model, Unsloth's and Gyro's files.

Related discussion

#2898 (feature request). No maintainer reply on scope yet: opened as a draft so the change can be read beside the request.

Approach

  • Whether a model is repacked now follows repacks() (shards that cut through layers: Unsloth's 4-6, Swift's 2)
    instead of the shard count. The n-gram table stays in Swift's shard 1.
  • --family takes swift beside qwen, unsloth and gyro. --family swift takes IQ3_S only, the size measured
    on a Mac; another size stops setup with the command to run.
    Images follow the original model's choice (on by default, --vision no turns them off), with Swift's own projector
    as on a PC: setup.py's Swift entry names UkisAI's mmproj-Swift-Qwen3.8-Flash-Next-BF16.gguf, and its size and
    SHA-256 (setup.py's pin) are added to VISION_SHA256.
  • Swift's pack size lives in strata_control/mac_fit.py (MAC_SWIFT, mac_model(), and an optional family
    argument on model_need_gb / streams / model_note). The existing callers (setup.py's Control mode,
    tools/strata_mcp.py, strata launch) pass (model, ram) and see no change.
  • No engine change: the pack, the MTP draft layer and the engine are the same. iq_pack writes Swift's 96 F32 routers
    as BF16 (all exact), and the draft layer is the original model's, as on a PC.
  • docs/MAC.md: the --family swift option, what is measured, and the Families line.

Validation

Re-run on v0.2.6 (2026-10-26). Rebased onto main 4b9e05a2 (v0.2.6). Only docs/MAC.md conflicted (upstream rewrote it); the setup commits are the same lines.

  • tools/test_setup_mac.py passes.
  • Swift 1.5 IQ3_S runs on v0.2.6's own engine (0.1.50-metal; this PR changes no engine code). Needles: 9 of 9 found at 2K, 16K and 32K, depths 10/50/90%.
  • With UkisAI's projector all three test pictures are read right: the shape counts, the invoice text word for word, and the bar order.

The rest of this section is the run on v0.2.2.

Environment: M5 Max 128 GB, macOS 26.7.1, Command Line Tools 27.0 (Apple clang 21).

Passed:

  • python3 tools/test_setup_mac.py on 8943a2b (= main 011c9e6, 0.2.2, + this PR's 2 commits): 32 tests OK, 6 of
    them new
    (the original's and Unsloth's file names and repack decision unchanged; Swift's file names, its repack, its engine
    arguments; IQ3_S with --vision yes and no warning, its projector's pin equal to setup.py's; an unmeasured size
    stopping; the choices without --family swift).
  • python3 -m unittest tools.test_strata_mcp.MacCatalog tools.test_strata_mcp.Helpers (the tests that import
    mac_fit): OK on this PR; python3 tools/test_setup_menu.py: OK.
  • Swift 1.5 IQ3_S on the Metal engine (SC117's abliterated build, the same two-file layout as UkisAI's release),
    repacked file 54.8 GB: decode 93.1-110.4 tok/s on 4 prompts (Qwen IQ3_S 94.3-109.2 on the same Mac), prompt
    1,636-1,731 tok/s, 6.8K-token needles 3 of 3, 3 reasoning questions right with thinking on. Measured on the 0.1.45
    engine with the Mac build fix that 0.2.0 carries.
  • The engine built from this branch (= main 011c9e6, 0.2.2, no engine change; cmake --build build-metal --target strata,
    0 errors) with the repacked Swift file, through this branch's serve/server.py at --max-context 262144: answers a
    short question ("Paris"), and tools/needle_bench.py --lengths 2k,16k,32k --depths 10,50,90 finds 9 of 9
    (1,644 / 15,070 / 31,643 prompt tokens). The same checks passed on 0.2.1.4 (main 9de04cd) before the rebase.
  • Images, with the same engine and server and UkisAI's projector (SHA-256 equal to the pin), greedy:
    three test pictures read right (6 shapes counted by color, an invoice transcribed exactly, 5 bars ranked).

Failed: none observed.

Not run:

  • tools/test_strata_mcp.py in full: its fake server uses port 8080, which a running Strata held on this Mac.
  • A fresh end-to-end ./setup.sh --family swift on 0.2.1.4 (55 GB download and repack). It ran end to end
    (--gguf-dir) before the rebase, on 0.1.45 with the Mac build fix.
  • UkisAI's own model files (SC117's build has the same layout; UkisAI's projector is the one checked above), other Macs, streaming on a smaller Mac, quality beyond 32K
    tokens, the KL harness, the Coder release.

Limits

  • IQ3_S only; other Swift sizes stop setup with a message until they are measured on a Mac.
  • Opt-in only: the size menu, the app and strata launch do not offer Swift.

🤖 Generated with Claude Code

oceanio pushed a commit to oceanio/Strata that referenced this pull request Oct 22, 2026
…t 1.5 reads images with its own projector

The branch was rebased, so its first commit is already in dev under another hash; the merge brings the images commit:
setup_mac.py drops the Swift images-off rule and pins UkisAI's mmproj-Swift in VISION_SHA256, MAC.md's Swift Images
line, and the two Swift tests (applied to dev's Swift class; dev's Parallel tests unchanged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
oceanio and others added 2 commits October 26, 2026 11:16
Swift's two shards cut through a layer (IQ3_S: layer 14's gate in shard 1, its up and down in shard 2) and its shard 1
holds the n-gram table, so the Metal engine, which maps one file, could not read it. Setup now repacks it with
metal/tools/metal_repack.py, as it does for Unsloth's files: whether a model is repacked follows repacks() (shards
that cut through layers) instead of the shard count. The n-gram table stays in Swift's shard 1 (ple_shard()).

- --family swift takes IQ3_S, the size measured on a Mac (MAC_SWIFT); another size stops setup with what to run.
- Images are off for Swift (the encoder is checked with the original model only), with a note when asked for.
- The pack, the MTP draft layer and the engine are unchanged: iq_pack writes Swift's 96 F32 routers as BF16 (all
  exact), and the draft layer is the original model's, as on a PC.
- Without --family swift nothing changes: the size menu, the original model and Unsloth's files.

Rebased onto 0.2.0: the pack sizes and their notes now live in strata_control/mac_fit.py, so MAC_SWIFT, mac_model() and
the family argument of model_need_gb / streams / model_note are there (optional: the app and setup.py's Control mode
are unchanged); setup_mac.py re-exports them.

Tests: tools/test_setup_mac.py (6 new): the original's and Unsloth's names and repack decision unchanged, Swift's
file names, its repack, its engine arguments, IQ3_S with images off, an unmeasured size stopping, and the choices
without --family swift.

Measured on an M5 Max (128 GB, macOS 26.7.1) with SC117's abliterated Swift 1.5 IQ3_S, engine 0.1.45 with the
Mac build fix (the one 0.2.0 carries):
decode 93.1-110.4 tok/s on 4 prompts (Qwen IQ3_S 94.3-109.2 on the same Mac), 6.8K-token needles 3 of 3, prompt
1,636-1,731 tok/s, 3 reasoning questions right with thinking on. Not measured: UkisAI's own files, a comparison with
the CUDA / HIP engine, the KL harness, contexts over 8K, streaming on a smaller Mac. docs/MAC.md says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Images were off for --family swift because the image encoder had been checked on the Mac with the original model
only.  Now they follow the same choice as the original (on by default, --vision no turns them off), with Swift's own
projector as on a PC: setup.py's family entry names UkisAI's mmproj-Swift-Qwen3.8-Flash-Next-BF16.gguf, and its size
and SHA-256 (setup.py's pin) are added to VISION_SHA256.

Checked on an M5 Max with SC117's abliterated Swift 1.5 IQ3_S and UkisAI's projector (SHA-256 = the pin), this
branch's engine and server, greedy: three test pictures read right (shapes counted by color,
an invoice transcribed exactly, five bars ranked).  tools/test_setup_mac.py: --family swift --vision yes warns about
nothing and the projector's pin equals setup.py's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Niko1221

Copy link
Copy Markdown
Owner

Thank you for the Mac setup work. Mac support is part of the Mac plan, which is planned for a later release, with no date yet. This will stay open until then.

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