Skip to content

Commit 2ef86e7

Browse files
committed
Clamp out of range values in K quantizer
This assertion fails when quantizing Mixtral 8x7b as Q5_K_M, because I used `convert.py --outtype f32` and the Mixtral weights use bf16 which has a much larger exponent range than the K quantizer is expecting. If --outtype f16 is used then the assert doesn't fail. See ggml-org#2982
1 parent 784e11d commit 2ef86e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ggml-quants.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ void dequantize_row_q8_0(const block_q8_0 * restrict x, float * restrict y, int6
10231023
// ===================== Helper functions
10241024
//
10251025
static inline int nearest_int(float fval) {
1026-
assert(fval <= 4194303.f);
1026+
fval = fminf(fval, 4194303.f);
10271027
float val = fval + 12582912.f;
10281028
int i; memcpy(&i, &val, sizeof(int));
10291029
return (i & 0x007fffff) - 0x00400000;

0 commit comments

Comments
 (0)