Skip to content

Commit c00fad7

Browse files
gguf-split : change binary multi-byte units to decimal (#7803)
1 parent 27615f5 commit c00fad7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/gguf-split/gguf-split.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ static size_t split_str_to_n_bytes(std::string str) {
6161
int n;
6262
if (str.back() == 'M') {
6363
sscanf(str.c_str(), "%d", &n);
64-
n_bytes = (size_t)n * 1024 * 1024; // megabytes
64+
n_bytes = (size_t)n * 1000 * 1000; // megabytes
6565
} else if (str.back() == 'G') {
6666
sscanf(str.c_str(), "%d", &n);
67-
n_bytes = (size_t)n * 1024 * 1024 * 1024; // gigabytes
67+
n_bytes = (size_t)n * 1000 * 1000 * 1000; // gigabytes
6868
} else {
6969
throw std::invalid_argument("error: supported units are M (megabytes) or G (gigabytes), but got: " + std::string(1, str.back()));
7070
}
@@ -284,7 +284,7 @@ struct split_strategy {
284284
struct ggml_tensor * t = ggml_get_tensor(ctx_meta, gguf_get_tensor_name(ctx_out, i));
285285
total_size += ggml_nbytes(t);
286286
}
287-
total_size = total_size / 1024 / 1024; // convert to megabytes
287+
total_size = total_size / 1000 / 1000; // convert to megabytes
288288
printf("split %05d: n_tensors = %d, total_size = %ldM\n", i_split + 1, gguf_get_n_tensors(ctx_out), total_size);
289289
i_split++;
290290
}

0 commit comments

Comments
 (0)