From a791a68b613b162c88a83f5f0225223bc167c762 Mon Sep 17 00:00:00 2001 From: Mack Straight Date: Mon, 20 Mar 2023 12:26:01 -0700 Subject: move file magic/version to header, print expected version (#319) --- quantize.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'quantize.cpp') diff --git a/quantize.cpp b/quantize.cpp index 166e916..07db33a 100644 --- a/quantize.cpp +++ b/quantize.cpp @@ -64,12 +64,12 @@ bool llama_model_quantize(const std::string & fname_inp, const std::string & fna { uint32_t magic; finp.read((char *) &magic, sizeof(magic)); - if (magic == 0x67676d6c) { + if (magic == FILE_MAGIC_UNVERSIONED) { fprintf(stderr, "%s: invalid model file '%s' (too old, regenerate your model files!)\n", __func__, fname_inp.c_str()); return false; } - if (magic != 0x67676d66) { + if (magic != FILE_MAGIC) { fprintf(stderr, "%s: invalid model file '%s' (bad magic)\n", __func__, fname_inp.c_str()); return false; } @@ -79,9 +79,9 @@ bool llama_model_quantize(const std::string & fname_inp, const std::string & fna uint32_t format_version; finp.read((char *) &format_version, sizeof(format_version)); - if (format_version != 1) { - fprintf(stderr, "%s: invalid model file '%s' (unsupported format version %" PRIu32 ")\n", - __func__, fname_inp.c_str(), format_version); + if (format_version != FILE_VERSION) { + fprintf(stderr, "%s: invalid model file '%s' (unsupported format version %" PRIu32 ", expected %d)\n", + __func__, fname_inp.c_str(), format_version, FILE_VERSION); return false; } -- cgit v1.2.3