Some tensors are transposed lmao
Browse files- generate_imatrix.py +5 -1
generate_imatrix.py
CHANGED
|
@@ -792,7 +792,11 @@ class TransformerRunner:
|
|
| 792 |
# Gated attention output
|
| 793 |
if gate_w is not None:
|
| 794 |
self._record(f'{pfx}.attn_gate.weight', attn_result)
|
| 795 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 796 |
|
| 797 |
# ── SSM path ──
|
| 798 |
ssm_alpha_w = self._get_weight(f'{pfx}.ssm_alpha.weight')
|
|
|
|
| 792 |
# Gated attention output
|
| 793 |
if gate_w is not None:
|
| 794 |
self._record(f'{pfx}.attn_gate.weight', attn_result)
|
| 795 |
+
# Some GGUF tensors are transposed. Ensure output matches hidden dim.
|
| 796 |
+
if gate_w.shape[1] == hidden.shape[-1]:
|
| 797 |
+
attn_out_vec = attn_result @ gate_w
|
| 798 |
+
else:
|
| 799 |
+
attn_out_vec = attn_result @ gate_w.T
|
| 800 |
|
| 801 |
# ── SSM path ──
|
| 802 |
ssm_alpha_w = self._get_weight(f'{pfx}.ssm_alpha.weight')
|