Proposal
Base on dev-4.x. Gate the initialize_native_model(...) call in boot on cfg.init_weights (transformer_lens/model_bridge/sources/native/__init__.py:56-62), and add a public TransformerBridge.init_weights() re-init method.
Motivation
Deprecating HookedTransformer moves train-from-scratch to boot_native, but the bridge ignores cfg.init_weights=False (randomizing weights anyway) and has no re-init entry point, breaking the load-into-empty-shell workflow.
Pitch
- Gate
initialize_native_model(...) on cfg.init_weights, keeping fork_rng for the seeded branch when init runs.
- Add
TransformerBridge.init_weights() re-running initialize_native_model in place, honoring cfg.seed.
- Raise a clear error when
init_weights() is called on a non-native (HF-loaded) bridge.
Acceptance:
Mirror: HT gate transformer_lens/HookedTransformer.py:254-255; HT init_weights at HookedTransformer.py:1500.
Checklist
Proposal
Base on
dev-4.x. Gate theinitialize_native_model(...)call inbootoncfg.init_weights(transformer_lens/model_bridge/sources/native/__init__.py:56-62), and add a publicTransformerBridge.init_weights()re-init method.Motivation
Deprecating
HookedTransformermoves train-from-scratch toboot_native, but the bridge ignorescfg.init_weights=False(randomizing weights anyway) and has no re-init entry point, breaking the load-into-empty-shell workflow.Pitch
initialize_native_model(...)oncfg.init_weights, keepingfork_rngfor the seeded branch when init runs.TransformerBridge.init_weights()re-runninginitialize_native_modelin place, honoringcfg.seed.init_weights()is called on a non-native (HF-loaded) bridge.Acceptance:
boot_native(cfg)withinit_weights=Falseleaves defaultnn.Linear/nn.Embeddingreset statebridge.init_weights()re-inits a native bridge in place, honoringcfg.seedinit_weights()on an HF-loaded bridge raises an actionable errortests/unit/model_bridge/test_boot_native.py(skip + re-init paths). The file already exists, it just needs to be extendedmake unit-testanduv run mypy .passMirror: HT gate
transformer_lens/HookedTransformer.py:254-255; HTinit_weightsatHookedTransformer.py:1500.Checklist