Upload generate_imatrix.py
Browse files- generate_imatrix.py +1 -4
generate_imatrix.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
-
|
| 4 |
|
| 5 |
Runs transformer forward passes over calibration text to collect per-channel
|
| 6 |
E[x²] activation statistics, then uses HPC triality BP to propagate importance
|
|
@@ -456,10 +456,7 @@ class TransformerRunner:
|
|
| 456 |
mask = np.triu(np.full((seq_len, seq_len), -1e9, dtype=np.float32), k=1)
|
| 457 |
swa = cfg.get('swa_window', 0)
|
| 458 |
if swa and swa > 0:
|
| 459 |
-
# Sliding window: mask out positions beyond the window
|
| 460 |
for i in range(seq_len):
|
| 461 |
-
for j in range(max(0, i - swa), i):
|
| 462 |
-
pass # already 0 (visible)
|
| 463 |
for j in range(0, max(0, i - swa)):
|
| 464 |
mask[i, j] = -1e9
|
| 465 |
attn = attn + mask[np.newaxis, :, :]
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
+
HExState Importance Matrix Generator — HPC-Enhanced iMatrix from GGUF
|
| 4 |
|
| 5 |
Runs transformer forward passes over calibration text to collect per-channel
|
| 6 |
E[x²] activation statistics, then uses HPC triality BP to propagate importance
|
|
|
|
| 456 |
mask = np.triu(np.full((seq_len, seq_len), -1e9, dtype=np.float32), k=1)
|
| 457 |
swa = cfg.get('swa_window', 0)
|
| 458 |
if swa and swa > 0:
|
|
|
|
| 459 |
for i in range(seq_len):
|
|
|
|
|
|
|
| 460 |
for j in range(0, max(0, i - swa)):
|
| 461 |
mask[i, j] = -1e9
|
| 462 |
attn = attn + mask[np.newaxis, :, :]
|