]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
build : fix reference to old llama_util.h
authorGeorgi Gerganov <redacted>
Sat, 29 Apr 2023 10:53:12 +0000 (13:53 +0300)
committerGeorgi Gerganov <redacted>
Sat, 29 Apr 2023 10:53:12 +0000 (13:53 +0300)
CMakeLists.txt
Makefile
examples/save-load-state/save-load-state.cpp

index 5fdbeddfca443cf465d0f2f76c6b6c6d56575037..bbf5995599934dfb3a98afaeafbcefd7e15df305 100644 (file)
@@ -337,7 +337,7 @@ endif()
 add_library(llama
             llama.cpp
             llama.h
-            llama_util.h)
+            llama-util.h)
 
 target_include_directories(llama PUBLIC .)
 target_compile_features(llama PUBLIC cxx_std_11) # don't bump
index 5a1cb3e83e365fdf65fd408b921c62e3446a93d1..fd695d7ddbd2268ad284945816505ed2bdee4979 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -168,7 +168,7 @@ $(info )
 ggml.o: ggml.c ggml.h ggml-cuda.h
        $(CC)  $(CFLAGS)   -c $< -o $@
 
-llama.o: llama.cpp ggml.h ggml-cuda.h llama.h llama_util.h
+llama.o: llama.cpp ggml.h ggml-cuda.h llama.h llama-util.h
        $(CXX) $(CXXFLAGS) -c $< -o $@
 
 common.o: examples/common.cpp examples/common.h
index f5f02ec1d350e280a24e635d6de2f4878b8db269..f1531ba39eb5e5a47f3e53a5e84090cfb965347f 100644 (file)
@@ -66,6 +66,7 @@ int main(int argc, char ** argv) {
 
     // first run
     printf("\n%s", params.prompt.c_str());
+
     for (auto i = 0; i < params.n_predict; i++) {
         auto logits = llama_get_logits(ctx);
         auto n_vocab = llama_n_vocab(ctx);
@@ -86,6 +87,7 @@ int main(int argc, char ** argv) {
         }
         n_past += 1;
     }
+
     printf("\n\n");
 
     // free old model
@@ -101,7 +103,13 @@ int main(int argc, char ** argv) {
             fprintf(stderr, "\n%s : failed to validate state size\n", __func__);
             return 1;
         }
-        fread(state_mem, 1, state_size, fp_read);
+
+        const size_t ret = fread(state_mem, 1, state_size, fp_read);
+        if (ret != state_size) {
+            fprintf(stderr, "\n%s : failed to read state\n", __func__);
+            return 1;
+        }
+
         llama_set_state_data(ctx2, state_mem);  // could also read directly from memory mapped file
         fclose(fp_read);
     }