Upload 3 files
Browse files- segmentation.py +4 -2
segmentation.py
CHANGED
|
@@ -239,8 +239,10 @@ def q3k_proxy(xg: np.ndarray, wg: np.ndarray | None) -> np.ndarray:
|
|
| 239 |
wu = np.ones_like(u)
|
| 240 |
else:
|
| 241 |
wu = np.asarray(wg, dtype=np.float64).reshape(n * (B // 16), 16)
|
| 242 |
-
scale,
|
| 243 |
-
|
|
|
|
|
|
|
| 244 |
return deq.reshape(n, B)
|
| 245 |
|
| 246 |
|
|
|
|
| 239 |
wu = np.ones_like(u)
|
| 240 |
else:
|
| 241 |
wu = np.asarray(wg, dtype=np.float64).reshape(n * (B // 16), 16)
|
| 242 |
+
# make_qkx2_batch returns (scale, -min, codes) with the GGML positive-dmin
|
| 243 |
+
# convention; reconstruction is scale * code - (-min).
|
| 244 |
+
scale, neg_min, codes = make_qkx2_batch(u, wu, nmax=7)
|
| 245 |
+
deq = scale[:, None] * codes - neg_min[:, None]
|
| 246 |
return deq.reshape(n, B)
|
| 247 |
|
| 248 |
|