Skip to content

Commit 0d80f62

Browse files
committed
error out if no layer_idx
1 parent 04fb8eb commit 0d80f62

File tree

1 file changed

+2
-1
lines changed
  • torchtitan/experiments/transformers_backend/model

1 file changed

+2
-1
lines changed

torchtitan/experiments/transformers_backend/model/model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ def _init_weights_patched(self, module):
171171

172172
if isinstance(module, layer_idx_classes):
173173
if not hasattr(module, "layer_idx"):
174-
return
174+
raise ValueError(f"Module {module} does not have a layer_idx attribute")
175+
175176
layer_idx = module.layer_idx
176177

177178
if hasattr(config, "depth_init") and config.depth_init:

0 commit comments

Comments
 (0)