diff options
author | Georgi Gerganov <ggerganov@gmail.com> | 2023-05-01 14:54:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-01 14:54:59 +0300 |
commit | 70269cae37538461ff816e714afbb3ebcdcdc26b (patch) | |
tree | 448ee5f5f8e93816fc7e60c7b05b29668536884a /llama.h | |
parent | b925f1f1b082319ee69943f8d1a83ac9b6ff09ca (diff) |
llama : fix session load / save (#1263)
Diffstat (limited to 'llama.h')
-rw-r--r-- | llama.h | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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 |