Skip to content

Commit

Permalink
ggml: add dequantization example (manual)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Bevenius <[email protected]>
  • Loading branch information
danbev committed Jun 16, 2024
1 parent eb06f2a commit 0e9c212
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fundamentals/ggml/src/ggml-quants.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ int main(int argc, char **argv) {
}
};
printf("block_q4_0 delta: %f\n", ggml_compute_fp16_to_fp32(block_q4_0.d));
printf("block_q4_0 qs:\n");
for (int i = 0; i < Q_SIZE; i++) {
for (int i = 0; i < QK4_0/2; i++) {
printf("block_q4_0.qs[%d]: %d\n", i, block_q4_0.qs[i]);
}

printf("Dequantize block_q4_0\n");
for (int i = 0; i < QK4_0/2; i++) {
printf("data[%d]: %f\n", i, block_q4_0.qs[i] * ggml_compute_fp16_to_fp32(block_q4_0.d));
}

return 0;
}

0 comments on commit 0e9c212

Please sign in to comment.