summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Zhou-Zheng <59622928+christianazinn@users.noreply.github.com>2024-06-07 08:56:01 -0400
committerGitHub <noreply@github.com>2024-06-07 15:56:01 +0300
commitc00fad71e507ff386d42bd74846fe06d19dd63a4 (patch)
treee82497fdb4b30e61ef00e973b42ee649ca80fb79
parent27615f5ab21060d96953c9c1e223051ab2188f57 (diff)
gguf-split : change binary multi-byte units to decimal (#7803)
-rw-r--r--examples/gguf-split/gguf-split.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/gguf-split/gguf-split.cpp b/examples/gguf-split/gguf-split.cpp
index e04feeae..881f0451 100644
--- a/examples/gguf-split/gguf-split.cpp
+++ b/examples/gguf-split/gguf-split.cpp
@@ -61,10 +61,10 @@ static size_t split_str_to_n_bytes(std::string str) {
int n;
if (str.back() == 'M') {
sscanf(str.c_str(), "%d", &n);
- n_bytes = (size_t)n * 1024 * 1024; // megabytes
+ n_bytes = (size_t)n * 1000 * 1000; // megabytes
} else if (str.back() == 'G') {
sscanf(str.c_str(), "%d", &n);
- n_bytes = (size_t)n * 1024 * 1024 * 1024; // gigabytes
+ n_bytes = (size_t)n * 1000 * 1000 * 1000; // gigabytes
} else {
throw std::invalid_argument("error: supported units are M (megabytes) or G (gigabytes), but got: " + std::string(1, str.back()));
}
@@ -284,7 +284,7 @@ struct split_strategy {
struct ggml_tensor * t = ggml_get_tensor(ctx_meta, gguf_get_tensor_name(ctx_out, i));
total_size += ggml_nbytes(t);
}
- total_size = total_size / 1024 / 1024; // convert to megabytes
+ total_size = total_size / 1000 / 1000; // convert to megabytes
printf("split %05d: n_tensors = %d, total_size = %ldM\n", i_split + 1, gguf_get_n_tensors(ctx_out), total_size);
i_split++;
}