Skip to content

Distribute and run LLMs with a single file.

Clamp K quant range when using f32 input

Justine Tunneycff55124ed53
diff --git a/llama.cpp/ggml-quants.c b/llama.cpp/ggml-quants.c
index 0b48007e..3b1c3aec 100644
--- a/llama.cpp/ggml-quants.c
+++ b/llama.cpp/ggml-quants.c
@@ -1202,7 +1202,7 @@ void dequantize_row_q8_0(const block_q8_0 * restrict x, float * restrict y, int6
// ===================== Helper functions
//
static inline int nearest_int(float fval) {
- assert(fval <= 4194303.f);
+ fval = fminf(fval, 4194303.f);
float val = fval + 12582912.f;
int i; memcpy(&i, &val, sizeof(int));
return (i & 0x007fffff) - 0x00400000;