Skip to content

Commit 40559c0

Browse files
fix(lfm2_5_vl): catch Exception not KeyError in convert_weights fallback
get_mapped_key raises Exception (not KeyError) for unknown keys like in_proj. The except clause never fired, causing the crash. Fix: catch Exception so in_proj falls through to the 3-way split branch. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 75942c4 commit 40559c0

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

examples/models/lfm2_5_vl/convert_weights.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ def lfm2_5_vl_to_meta(state_dict: Dict[str, torch.Tensor]) -> Dict[str, torch.Te
7070

7171
try:
7272
new_key = get_mapped_key(key, _LFM2_5_VL_TO_META)
73-
except KeyError:
74-
# Fallback: strip "model.language_model." prefix
73+
except Exception:
74+
# Fallback: strip "model.language_model." prefix.
75+
# This covers in_proj (handled below) and any passthrough keys.
7576
new_key = key.removeprefix("model.language_model.")
7677

7778
# Split conv in_proj: [3*dim, dim] -> B_proj, C_proj, x_proj each [dim, dim]

0 commit comments

Comments
 (0)