diff options
author | Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com> | 2024-04-14 13:12:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-14 13:12:59 +0200 |
commit | 8800226d65d5c98cd34eede6a6c05c78405c52da (patch) | |
tree | b90c3b037ec31b8735ee5fcf36ec78c217606358 /examples/gguf-split/gguf-split.cpp | |
parent | e689fc4e912feb19085be6894f475a873759cbfe (diff) |
Fix --split-max-size (#6655)
* Fix --split-max-size
Byte size calculation was done on int and overflowed.
* add tests.sh
* add examples test scripts to ci run
Will autodiscover examples/*/tests.sh scripts and run them.
* move WORK_PATH to a subdirectory
* clean up before and after test
* explicitly define which scripts to run
* add --split-max-size to readme
Diffstat (limited to 'examples/gguf-split/gguf-split.cpp')
-rw-r--r-- | examples/gguf-split/gguf-split.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/gguf-split/gguf-split.cpp b/examples/gguf-split/gguf-split.cpp index 24acbf02..39c75e0a 100644 --- a/examples/gguf-split/gguf-split.cpp +++ b/examples/gguf-split/gguf-split.cpp @@ -59,10 +59,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 = n * 1024 * 1024; // megabytes + n_bytes = (size_t)n * 1024 * 1024; // megabytes } else if (str.back() == 'G') { sscanf(str.c_str(), "%d", &n); - n_bytes = n * 1024 * 1024 * 1024; // gigabytes + n_bytes = (size_t)n * 1024 * 1024 * 1024; // gigabytes } else { throw std::invalid_argument("error: supported units are M (megabytes) or G (gigabytes), but got: " + std::string(1, str.back())); } |