aboutsummaryrefslogtreecommitdiff
path: root/llama.h
diff options
context:
space:
mode:
Diffstat (limited to 'llama.h')
-rw-r--r--llama.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/llama.h b/llama.h
index e95ff73..f68a0cb 100644
--- a/llama.h
+++ b/llama.h
@@ -129,6 +129,18 @@ extern "C" {
size_t n_size,
int n_token_count);
+ // Returns the size in bytes of the state (rng, logits, embedding and kv_cache)
+ LLAMA_API size_t llama_get_state_size(struct llama_context * ctx);
+
+ // Copies the state to the specified destination address.
+ // Destination needs to have allocated enough memory.
+ // Returns the number of bytes copied
+ LLAMA_API size_t llama_copy_state_data(struct llama_context * ctx, uint8_t * dest);
+
+ // Set the state reading from the specified address
+ // Returns the number of bytes read
+ LLAMA_API size_t llama_set_state_data(struct llama_context * ctx, const uint8_t * src);
+
// 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
// n_past is the number of tokens to use from previous eval calls