Repository navigation
Fix Apertus Instruct model mapper pointing at the base upstream repo - #7339
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
f85b86a to
aeb7161
Compare
|
Rebased onto main; mergeable again. The two mapper entries this PR corrects are unchanged upstream, so the conflict was context drift: a duplicate |
|
Pushed 7eeb607 for the one red that was actually mine, and controlled the rest.
The other reds are not from this change: |
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
The 8B entry is correct: |
|
You are right, and I checked it against the Hub rather than take it on trust: Fixed in So a 16bit load of the base The fix takes your second option, and # No Unsloth 16bit repo exists at this size, so this is a 1-tuple naming the
# real upstream, same as the other 70B and 405B rows.
"unsloth/Apertus-70B-Instruct-2509-unsloth-bnb-4bit" : (
"swiss-ai/Apertus-70B-Instruct-2509",
),
The 8B row keeps its full 3-tuple and its 16bit redirect, since that repo exists. I also added a second test that asserts no entry in any of the three mappers resolves to |
|
@codex review |
|
Confirmed against main at unsloth/models/mapper.py:1119-1127, where the Apertus Instruct rows still name the base swiss-ai repos so a base load resolves to the Unsloth instruct weights, and the 70B row now follows the existing 1-tuple convention. One check, Security audit pip scan-packages :: extras, is green on main but red here, so please take a look at that before we review. |
Slot 1 of an __INT_TO_FLOAT_MAPPER entry names the upstream repo the Unsloth build mirrors, and mapper.py turns it into FLOAT_TO_INT_MAPPER[upstream] and MAP_TO_UNSLOTH_16bit[upstream]. Both Apertus rows named the pretrained BASE repo, so loading swiss-ai/Apertus-8B-2509 resolved to the Unsloth Instruct weights and swiss-ai/Apertus-8B-Instruct-2509 matched nothing at all. The 70B row is a 1-tuple naming the real upstream, because unsloth/Apertus-70B-Instruct-2509 is not published; only the GGUF and -unsloth-bnb-4bit repos exist. That matches the other 70B and 405B rows. tests/test_apertus_instruct_mapping.py pins both directions and asserts no Apertus lookup resolves to the unpublished 70B 16bit repo. It is registered in the Bucket-A list in consolidated-tests-ci.yml, whose count is bumped to match the list it describes. Rebased onto current main; the resulting diff is unchanged.
6b325e4 to
cc81fbd
Compare
|
Thanks. Looked at it; the short version is that the run predates the current dependency set and I have rebased so it re-runs. That run is from 2026-07-22, when the branch was cut at So I have rebased onto current main ( One thing in the diff worth flagging so it does not read as a miscount: the Bucket-A comment goes 17 to 21. Separately, and my mistake: I opened #9311 earlier today against these same two rows, having scanned |
|
Re-checked at the current head: the 8B row now names the real instruct upstream and the 70B row follows the existing 1-tuple convention, so no Apertus lookup lands on the unpublished 16bit repo. |
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Confirmed the Apertus base names no longer redirect to Instruct weights. The 8B Instruct path reaches the published Unsloth models, while 70B preserves the Swiss AI 16-bit upstream and still maps to the published dynamic 4-bit repo. |
Summary
The two Apertus Instruct entries in
__INT_TO_FLOAT_MAPPER(unsloth/models/mapper.py) name the base upstream repo as their original model, even though the key, the Unsloth 16bit name, and the Unsloth 4bit name all refer to the Instruct variant:Every other 3-tuple in this table keeps the invariant that the second element is the same model variant as the key, with only the org prefix swapped (e.g.
unsloth/granite-4.0-microtoibm-granite/granite-4.0-micro). These two entries were the only violations.Why it matters
The build loop wires the upstream name (
values[1]) into bothFLOAT_TO_INT_MAPPERandMAP_TO_UNSLOTH_16bit, so with the wrong value:swiss-ai/Apertus-70B-2509was silently redirected to the Unsloth Instruct model (unsloth/Apertus-70B-Instruct-2509/ its 4bit quant).swiss-ai/Apertus-70B-Instruct-2509was registered nowhere, so it never resolved to the Unsloth-optimized version. Same for the 8B pair.Reproduction (exec the import-free mapper module, no GPU):
Both
swiss-ai/Apertus-70B-2509(base) andswiss-ai/Apertus-70B-Instruct-2509(instruct) exist as separate repos on the Hub, so this is a clear typo rather than a naming quirk.Fix
Point the upstream at the Instruct repo for both the 70B and 8B entries, restoring the table's invariant.
Test
tests/test_apertus_instruct_mapping.pyexec's the import-freemapper.pyand asserts the instruct upstream resolves to the Unsloth instruct 16bit/4bit models and the base upstream is not redirected to the instruct model. It fails before this change (instruct upstream resolves toNone) and passes after. Wired into the Bucket-A CPU CI step, alongside the existingtest_gemma_2b_mapper_key.py/test_bad_mappings_redirect.py.