Skip to content

Commit 6711a0d

Browse files
converter: add warnings for unexpected mm.2 weight shapes
Co-authored-by: Copilot <[email protected]>
1 parent a5cf45a commit 6711a0d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

convert_hf_to_gguf.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3975,9 +3975,16 @@ def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iter
39753975
expected = getattr(self, "n_embd_text", None)
39763976
if isinstance(expected, int) and expected > 0:
39773977
if d0 == expected and d1 == expected:
3978-
pass
3978+
pass # already canonical
39793979
elif d1 == expected and d0 != expected:
3980+
logging.warning(
3981+
f"mm.2 weight shape {data_torch.shape} for {name}: d1 matches expected ({expected}), d0={d0} does not. Transposing, but please verify correctness."
3982+
)
39803983
data_torch = data_torch.transpose(-1, -2)
3984+
else:
3985+
logging.warning(
3986+
f"mm.2 weight shape {data_torch.shape} for {name}: neither dimension matches expected ({expected}). Leaving as-is, but this may be incorrect."
3987+
)
39813988
return [(new_name, data_torch)]
39823989
return [(new_name, data_torch)]
39833990
# Unknown mlp1 component -> skip

0 commit comments

Comments
 (0)