Skip to content

Commit

Permalink
llama : constified llama_set_state_data's src (ggerganov#5774)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusDunn authored Feb 29, 2024
1 parent 87c91c0 commit d5ab297
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion llama.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit d5ab297

Please sign in to comment.