summaryrefslogtreecommitdiff
path: root/examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp
diff options
context:
space:
mode:
authorCebtenzzre <cebtenzzre@gmail.com>2023-09-07 13:22:29 -0400
committerGitHub <noreply@github.com>2023-09-07 13:22:29 -0400
commit00d62adb79bf914a95fb9a2e8f42f3029e76d62c (patch)
tree36d294e4df3ded0cd0f3c96ab7bd64dd800002ec /examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp
parent4fa2cc1750b861880de42515cb19c13b2d776ee2 (diff)
fix some warnings from gcc and clang-tidy (#3038)
Co-authored-by: xaedes <xaedes@gmail.com>
Diffstat (limited to 'examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp')
-rw-r--r--examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp b/examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp
index 9e856c21..293b455d 100644
--- a/examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp
+++ b/examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp
@@ -1,5 +1,6 @@
#include "ggml.h"
#include "llama.h"
+#include "common.h"
#include <unordered_map>
#include <vector>
@@ -499,10 +500,10 @@ struct llama_file {
errno = 0;
std::size_t ret = std::fread(ptr, size, 1, fp);
if (ferror(fp)) {
- throw std::runtime_error(format("read error: %s", strerror(errno)));
+ die_fmt("fread failed: %s", strerror(errno));
}
if (ret != 1) {
- throw std::runtime_error(std::string("unexpectedly reached end of file"));
+ die("unexpectedly reached end of file");
}
}
@@ -597,8 +598,7 @@ void load_vocab(const char *filename, Config *config, struct llama_vocab *vocab)
printf("Assuming llama2.c vocabulary since %s is not a gguf file\n", filename);
llama_file file(filename, "rb");
if (!file.fp) {
- fprintf(stderr, "error: %s: %s\n", strerror(errno), filename);
- exit(1);
+ die_fmt("%s: %s", strerror(errno), filename);
}
const int n_vocab = config->vocab_size;
/* uint32_t max_token_length = */ file.read_u32(); // unused