Repository navigation
fix(bridge): route legacy TL-format repos from boot_transformers to boot_tl_legacy - #2029
Open
pablocs116 wants to merge 1 commit into
Open
pablocs116 wants to merge 1 commit into
pablocs116 wants to merge 1 commit into
Conversation
…oot_tl_legacy NeelNanda/*, ArthurConmy/* and Baidicoot/* repos (and aliases like gelu-1l, solu-1l) have no HF model_type, so boot_transformers failed in AutoConfig. Hand them to boot_tl_legacy with a warning pointing at the direct call, forward device/dtype/tokenizer/checkpoint args, and raise on HF loading options boot_tl_legacy can't honor. A pre-loaded hf_model skips the routing. Closes TransformerLensOrg#2025 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jlarson4
reviewed
Nov 17, 2026
jlarson4
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for putting this together @pablocs116, just a couple small notes, and a small bug I did not think about when reviewing your original proposal. Take a look and let me know what you think.
| ) | ||
| model_name = official_name | ||
| # A pre-loaded hf_model is HF-format by construction, whatever its repo name. | ||
| if hf_model is None and model_name.startswith(TL_LEGACY_PREFIXES): |
Collaborator
There was a problem hiding this comment.
Something not previously taken into account: these namespaces also host regular HF-format models, e.g. Baidicoot/Llama-3-8B-Instruct-LAT. Those load through boot_transformers, but with this change would fail with KeyError: 'd_model'. Can we route on something narrower than the namespace?
| device="cpu", | ||
| dtype=torch.float16, | ||
| tokenizer=tokenizer, | ||
| checkpoint_index=3, |
Collaborator
There was a problem hiding this comment.
Every case here leaves checkpoint_value as None, so the tests still pass if the routing stops forwarding it. Could one case pass a real value?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2025
Problem
TransformerBridge.boot_transformerscouldn't load legacy TransformerLens-format repos (NeelNanda/*,ArthurConmy/*,Baidicoot/*), even though they and their aliases (gelu-1l,solu-1l,attn-only-2l, ...) are in the model registry. The alias resolved to the repo ID, and thenAutoConfigfailed withUnrecognized model ... Should have a model_type key.boot_tl_legacyloads these repos, but nothing pointed to it.Fix
In
sources/transformers/source.py::boot, after alias resolution, a name underTL_LEGACY_PREFIXESis handed toboot_tl_legacy:TransformerBridge.boot_tl_legacy('<repo>')call to use instead.device,dtype(None→ float32, the same as a freshboot_transformersload),tokenizer,checkpoint_index/checkpoint_value.ValueErrornamingboot_tl_legacyand the offending arguments, instead of being silently dropped:hf_config_overrides,load_weights=False,model_class,n_ctx,revision,code_revision,device_map,n_devices,max_memory,offload_folder.trust_remote_codeis ignored, since.pthrepos run no remote code.hf_model=skips the routing. A pre-loaded model is HF-format whatever its repo name, sobootkeeps reading its config as before.Docs: the
model_namedocstring andmigrating_to_v4.mdnow describe the routing and recommend callingboot_tl_legacydirectly.Tests
tests/unit/model_bridge/test_boot_tl_legacy_routing.py(new, mocked, no network, 15 tests): alias and repo ID both route, with the warning; supported options are forwarded; each unsupported option raises without loading; HF-format names andhf_model=aren't routed.tests/integration/model_bridge/test_tl_legacy_loader.py:boot_transformers("solu-1l")gives logits identical toboot_tl_legacy("NeelNanda/SoLU_1L512W_C4_Code").ValueError, and the unit tests error.Ran locally (CPU, Linux/WSL2):
test_tl_legacy_loader.py: 24 passedtests/unit/model_bridge/test_boot_*.py+tests/unit/model_bridge/sources: 144 passed, 2 skipped (optionalinspect_ainot installed)make format,uv run mypy .: cleanDownstream: SAELens works around this today (decoderesearch/SAELens#789) and can drop that once this ships.
🤖 Generated with Claude Code