Skip to content

Commit 305eb5a

Browse files
committed
build : fix reference to old llama_util.h
1 parent 84ca9c2 commit 305eb5a

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ endif()
337337
add_library(llama
338338
llama.cpp
339339
llama.h
340-
llama_util.h)
340+
llama-util.h)
341341

342342
target_include_directories(llama PUBLIC .)
343343
target_compile_features(llama PUBLIC cxx_std_11) # don't bump

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ $(info )
168168
ggml.o: ggml.c ggml.h ggml-cuda.h
169169
$(CC) $(CFLAGS) -c $< -o $@
170170

171-
llama.o: llama.cpp ggml.h ggml-cuda.h llama.h llama_util.h
171+
llama.o: llama.cpp ggml.h ggml-cuda.h llama.h llama-util.h
172172
$(CXX) $(CXXFLAGS) -c $< -o $@
173173

174174
common.o: examples/common.cpp examples/common.h

examples/save-load-state/save-load-state.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ int main(int argc, char ** argv) {
6666

6767
// first run
6868
printf("\n%s", params.prompt.c_str());
69+
6970
for (auto i = 0; i < params.n_predict; i++) {
7071
auto logits = llama_get_logits(ctx);
7172
auto n_vocab = llama_n_vocab(ctx);
@@ -86,6 +87,7 @@ int main(int argc, char ** argv) {
8687
}
8788
n_past += 1;
8889
}
90+
8991
printf("\n\n");
9092

9193
// free old model
@@ -101,7 +103,13 @@ int main(int argc, char ** argv) {
101103
fprintf(stderr, "\n%s : failed to validate state size\n", __func__);
102104
return 1;
103105
}
104-
fread(state_mem, 1, state_size, fp_read);
106+
107+
const size_t ret = fread(state_mem, 1, state_size, fp_read);
108+
if (ret != state_size) {
109+
fprintf(stderr, "\n%s : failed to read state\n", __func__);
110+
return 1;
111+
}
112+
105113
llama_set_state_data(ctx2, state_mem); // could also read directly from memory mapped file
106114
fclose(fp_read);
107115
}

0 commit comments

Comments
 (0)