Skip to content

Commit 64a5190

Browse files
committed
Fix vocab-only; silence copmiler warning about multichar literals
1 parent ae32a25 commit 64a5190

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ if (LLAMA_ALL_WARNINGS)
139139
-Wpedantic
140140
-Wcast-qual
141141
-Wno-unused-function
142+
-Wno-multichar
142143
)
143144
else()
144145
# todo : msvc

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ LDFLAGS =
3737

3838
# warnings
3939
CFLAGS += -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -Wno-unused-function
40-
CXXFLAGS += -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function
40+
CXXFLAGS += -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-multichar
4141

4242
# OS specific
4343
# TODO: support Windows

llama.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -558,10 +558,10 @@ struct llama_model_loader {
558558
struct ggml_context * ggml_ctx = NULL;
559559
std::unique_ptr<llama_mmap> mapping;
560560

561-
llama_model_loader(const std::string & fname_base, bool use_mmap) {
561+
llama_model_loader(const std::string & fname_base, bool use_mmap, bool vocab_only) {
562562
auto first_file = new llama_file_loader(fname_base.c_str(), 0, tensors_map);
563563
file_loaders.emplace_back(first_file);
564-
uint32_t n_parts = guess_n_parts();
564+
uint32_t n_parts = vocab_only ? 1 : guess_n_parts();
565565
for (uint32_t i = 1; i < n_parts; i++) {
566566
std::string fname = fname_base + "." + std::to_string(i);
567567
auto ith_file = new llama_file_loader(fname.c_str(), i, tensors_map);
@@ -603,7 +603,6 @@ struct llama_model_loader {
603603
return file_loaders.at(0)->hparams.n_embd / lt.shards.at(0).ne.at(0);
604604
}
605605

606-
607606
void calc_sizes(size_t * ctx_size_p, size_t * mmapped_size_p) const {
608607
*ctx_size_p = *mmapped_size_p = 0;
609608
for (const llama_load_tensor & lt : tensors_map.tensors) {
@@ -817,7 +816,7 @@ static void llama_model_load_internal(
817816

818817
lctx.t_start_us = ggml_time_us();
819818

820-
std::unique_ptr<llama_model_loader> ml(new llama_model_loader(fname, use_mmap));
819+
std::unique_ptr<llama_model_loader> ml(new llama_model_loader(fname, use_mmap, vocab_only));
821820

822821
lctx.vocab = std::move(ml->file_loaders.at(0)->vocab);
823822
auto & model = lctx.model;
@@ -1526,7 +1525,8 @@ static void llama_model_quantize_internal(const std::string & fname_inp, const s
15261525
default: throw format("invalid quantization type %d\n", itype);
15271526
};
15281527

1529-
std::unique_ptr<llama_model_loader> model_loader(new llama_model_loader(fname_inp.c_str(), /*use_mmap*/ false));
1528+
std::unique_ptr<llama_model_loader> model_loader(new llama_model_loader(fname_inp.c_str(), /*use_mmap*/ false,
1529+
/*vocab_only*/ false));
15301530
llama_file_saver file_saver(fname_out.c_str(), model_loader->file_loaders.at(0).get(), (uint32_t) itype);
15311531

15321532
size_t total_size_org = 0;

0 commit comments

Comments
 (0)