From 70269cae37538461ff816e714afbb3ebcdcdc26b Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Mon, 1 May 2023 14:54:59 +0300 Subject: llama : fix session load / save (#1263) --- llama.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'llama.h') diff --git a/llama.h b/llama.h index 9fbba76..2f6ce8d 100644 --- a/llama.h +++ b/llama.h @@ -19,9 +19,11 @@ # define LLAMA_API #endif -#define LLAMA_FILE_VERSION 1 -#define LLAMA_FILE_MAGIC 0x67676a74 // 'ggjt' in hex -#define LLAMA_FILE_MAGIC_UNVERSIONED 0x67676d6c // pre-versioned files +#define LLAMA_FILE_VERSION 1 +#define LLAMA_FILE_MAGIC 'ggjt' +#define LLAMA_FILE_MAGIC_UNVERSIONED 'ggml' +#define LLAMA_SESSION_MAGIC 'ggsn' +#define LLAMA_SESSION_VERSION 0 #ifdef __cplusplus extern "C" { @@ -138,8 +140,8 @@ extern "C" { LLAMA_API size_t llama_set_state_data(struct llama_context * ctx, const uint8_t * src); // Save/load session file - LLAMA_API size_t llama_load_session_file(struct llama_context * ctx, const char * path_session, llama_token * tokens_out, size_t n_token_capacity, size_t * n_token_count_out); - LLAMA_API size_t llama_save_session_file(struct llama_context * ctx, const char * path_session, const llama_token * tokens, size_t n_token_count); + LLAMA_API bool llama_load_session_file(struct llama_context * ctx, const char * path_session, llama_token * tokens_out, size_t n_token_capacity, size_t * n_token_count_out); + LLAMA_API bool llama_save_session_file(struct llama_context * ctx, const char * path_session, const llama_token * tokens, size_t n_token_count); // Run the llama inference to obtain the logits and probabilities for the next token. // tokens + n_tokens is the provided batch of new tokens to process -- cgit v1.2.3