mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3537] [Other] setup (Mac): Swift 1.5 IQ3_S, opt-in with --family swift #4676
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4676
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/3537
Author: @oceanio
Created: 10/21/2026
Status: 🔄 Open
Base:
main← Head:feat/mac-swift📝 Commits (2)
5596527setup (Mac): Swift 1.5 IQ3_S, opt-in with --family swiftaa30567setup (Mac): Swift 1.5 reads images, with its own projector📊 Changes
4 files changed (+165 additions, -39 deletions)
View changed files
📝
docs/MAC.md(+36 -4)📝
metal/setup_mac.py(+38 -22)📝
strata_control/mac_fit.py(+23 -13)📝
tools/test_setup_mac.py(+68 -0)📄 Description
Problem and result
On a Mac,
./setup.shsets 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 swiftdownloads Swift 1.5 IQ3_S, repacks its shards into one GGUF with the existingmetal/tools/metal_repack.py(as setup already does for Unsloth's files), builds the pack and writes a config. Without--family swiftnothing 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
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.
--familytakesswiftbesideqwen,unslothandgyro.--family swifttakes IQ3_S only, the size measuredon a Mac; another size stops setup with the command to run.
Images follow the original model's choice (on by default,
--vision noturns them off), with Swift's own projectoras on a PC:
setup.py's Swift entry names UkisAI'smmproj-Swift-Qwen3.8-Flash-Next-BF16.gguf, and its size andSHA-256 (
setup.py's pin) are added toVISION_SHA256.strata_control/mac_fit.py(MAC_SWIFT,mac_model(), and an optionalfamilyargument 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.iq_packwrites Swift's 96 F32 routersas BF16 (all exact), and the draft layer is the original model's, as on a PC.
--family swiftoption, what is measured, and the Families line.Validation
Re-run on v0.2.11 (2026-11-06). Rebased onto main
c3b3f503(v0.2.11). Two conflicts, both beside 0.2.11's Unsloth v3.1 sets:mac_fit.pykeeps 0.2.11's Mac app helpers next tomac_model, andmodel_shard_namesnames Unsloth's shards throughsetup.py'smodel_file, as 0.2.11 does. Swift's download URL is unchanged:model_hfonly moves the v3.1 sets, which carry a revision. At the new tipaa305676:tools/test_setup_mac.py: 48 tests OK;tools/test_setup_menu.pyOK;tools.test_strata_mcpMacCatalog and Helpers: 20 OK. The last set ran withTMPDIRoutside macOS's/var/folders, where 0.2.11's new Unsloth install-plan test fails on main too (check_data_dircalls it a system folder).engine_envandspec_argsas they were, so the v0.2.10 measurements below still describe what setup writes for Swift.Re-run on v0.2.10 (2026-11-03). Rebased onto main
ffa80d73(v0.2.10) with no conflicts; the setup commits are the same lines. At the new tip486cc722:tools/test_setup_mac.py: 38 tests OK.Swift 1.5 IQ3_S runs on v0.2.10's own engine (0.1.56-metal; this PR changes no engine code). Needles: 9 of 9 found at 2K, 16K and 32K, depths 10/50/90%.
All three test pictures are read right: the shape counts, the invoice text word for word, and the tallest and shortest bars. The projector is the same copy as on v0.2.9 (below).
0.2.10's Mac setup writes
STRATA_METAL_F16=1and--spec 3 --spec-min-p 0.5into the config of a resident IQ3_S pack (mac_fit.engine_envandspec_args).--family swifttakes IQ3_S, so a Swift config gets both, although they were measured on Qwen3.8-Flash-Next. I measured them on Swift and they hold there, so this PR adds no exception for Swift:--spec 2with the fp32 decode--spec 2, fp32 (tok/s)--spec 3 --spec-min-p 0.5STRATA_METAL_F16=1Setup: M5 Max, Swift 1.5 IQ3_S resident, MTP, 262K context,
"parallel": 2, one request at a time, greedy, 300 tokens (the agent turn's answer is a 93-token tool call). Medians of the per-round ratios over 5 rounds, with the arms' order rotated each round. The engine was my build of 0.2.10 plus my open Mac PRs (#3536, #3541, #4960, #4961). On the same Qwen config it gives 0.2.10's tokens (8 of 8 requests) and speed (98.4 against 98.3 tok/s).--spec 3gives the same tokens as--spec 2, with and without the fp16 decode, in every round.tools/quant_quality.pyagainst the fp32 decode (the v1 set, 4,995 positions, teacher-forced): top-1 agreement 95.5%, mean KL 0.018 (p99 0.25), perplexity 4.017 against 4.009. That is close to the commit's Qwen IQ3_S figures (96.2%, 0.016). The weakest segment is docs (91.3%, 0.029)."parallel": 2, a request decoded in a batch slot beside another gives the same tokens as alone with the fp32 decode, and other tokens with the fp16 decode, because the slot rows stay fp32.On v0.2.9 (tip
7e9b9a0e, 2026-11-01): 35 setup tests OK, needles 9 of 9, the three pictures read right. The projector was SC117's copy (mmproj-Qwen3.8-Flash-Next-BF16.ggufin SC117's Swift repo); its 334 tensors are byte-identical to UkisAI's file that this PR pins, and only thegeneral.*metadata differs.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.pyon 8943a2bb (=main011c9e60, 0.2.2, + this PR's 2 commits): 32 tests OK, 6 ofthem 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 yesand no warning, its projector's pin equal tosetup.py's; an unmeasured sizestopping; the choices without
--family swift).python3 -m unittest tools.test_strata_mcp.MacCatalog tools.test_strata_mcp.Helpers(the tests that importmac_fit): OK on this PR;python3 tools/test_setup_menu.py: OK.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.
main011c9e60, 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.pyat--max-context 262144: answers ashort question ("Paris"), and
tools/needle_bench.py --lengths 2k,16k,32k --depths 10,50,90finds 9 of 9(1,644 / 15,070 / 31,643 prompt tokens). The same checks passed on 0.2.1.4 (
main9de04cd4) before the rebase.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.pyin full: its fake server uses port 8080, which a running Strata held on this Mac../setup.sh --family swifton 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.tokens, the KL harness against a Q8_0 or CUDA reference, the Coder release, the 61-task quality suite that the fp16
default passed on Qwen (not available here).
Limits
strata launchdo not offer Swift.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.