Fix re-quantizing a model using row-interleaved quants (#1561)

This commit is contained in:
Kawrakow 2026-03-31 15:35:10 +02:00 committed by GitHub
parent bd7daa7176
commit 8b575c4b1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 0 deletions

View File

@ -165,6 +165,19 @@ static void llama_tensor_dequantize_internal(
return;
}
auto num_rows = interleaved_properties(tensor->type).second;
if (num_rows > 1) {
int nrows = ggml_nrows(tensor);
auto row_size = ggml_row_size(tensor->type, tensor->ne[0]);
auto qsrc = (const char *)tensor->data;
for (int row = 0; row < nrows; row += num_rows) {
qtype.to_float(qsrc, f32_output, num_rows*tensor->ne[0]);
qsrc += num_rows*row_size;
f32_output += num_rows*tensor->ne[0];
}
return;
}
size_t block_size;
if (tensor->type == GGML_TYPE_F16 ||
tensor->type == GGML_TYPE_BF16) {