]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llama : constified `llama_set_state_data`'s `src` (#5774)
authorMarcus Dunn <redacted>
Thu, 29 Feb 2024 08:17:23 +0000 (00:17 -0800)
committerGitHub <redacted>
Thu, 29 Feb 2024 08:17:23 +0000 (10:17 +0200)
llama.cpp
llama.h

index 30d5eb32dab83561a7434831a0721ce7b3264ae4..62699ce52e19720584937b1aca430956a081050b 100644 (file)
--- a/llama.cpp
+++ b/llama.cpp
@@ -12545,8 +12545,8 @@ size_t llama_copy_state_data(struct llama_context * ctx, uint8_t * dst) {
 }
 
 // Sets the state reading from the specified source address
-size_t llama_set_state_data(struct llama_context * ctx, uint8_t * src) {
-    uint8_t * inp = src;
+size_t llama_set_state_data(struct llama_context * ctx, const uint8_t * src) {
+    const uint8_t * inp = src;
 
     // set rng
     {
@@ -12555,7 +12555,7 @@ size_t llama_set_state_data(struct llama_context * ctx, uint8_t * src) {
 
         GGML_ASSERT(rng_size <= LLAMA_MAX_RNG_STATE);
 
-        std::string rng_str((char *)inp, rng_size); inp += rng_size;
+        std::string rng_str((const char *)inp, rng_size); inp += rng_size;
 
         std::istringstream rng_ss(rng_str);
         rng_ss >> ctx->rng;
diff --git a/llama.h b/llama.h
index a6823bb2bd5b9e70773fdc95fcc4d4b74a10f112..4d0ebe37d3f9be23a413313247fe19edb0473972 100644 (file)
--- a/llama.h
+++ b/llama.h
@@ -575,7 +575,7 @@ extern "C" {
     // Returns the number of bytes read
     LLAMA_API size_t llama_set_state_data(
             struct llama_context * ctx,
-                         uint8_t * src);
+                   const uint8_t * src);
 
     // Save/load session file
     LLAMA_API bool llama_load_session_file(