Skip to content

Commit 9d48a5b

Browse files
authored
Merge pull request #9 from ggml-org/compilade/fix-qp-iq1-problems
ggml-quants : avoid division by zero in make_q3_quants
2 parents 9051e05 + fb573f4 commit 9d48a5b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ggml/src/ggml-quants.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ static float make_q3_quants(int n, int nmax, const float * GGML_RESTRICT x, int8
566566
for (int i = 0; i < n; ++i) {
567567
L[i] += nmax;
568568
}
569-
return sumlx / suml2;
569+
return suml2 > 0.0f ? sumlx / suml2 : 0.0f;
570570
}
571571
for (int i = 0; i < n; ++i) {
572572
int l = nearest_int(iscale * x[i]);

0 commit comments

Comments
 (0)