MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / llama_save_session_file

Function llama_save_session_file

llama.cpp:10563–10580  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10561}
10562
10563bool llama_save_session_file(struct llama_context * ctx, const char * path_session, const llama_token * tokens, size_t n_token_count) {
10564 llama_file file(path_session, "wb");
10565
10566 file.write_u32(LLAMA_SESSION_MAGIC);
10567 file.write_u32(LLAMA_SESSION_VERSION);
10568
10569 file.write_raw(&ctx->model.hparams, sizeof(llama_hparams));
10570
10571 // save the prompt
10572 file.write_u32((uint32_t) n_token_count);
10573 file.write_raw(tokens, sizeof(llama_token) * n_token_count);
10574
10575 // save the context state using stream saving
10576 llama_data_file_context data_ctx(&file);
10577 llama_copy_state_data_internal(ctx, &data_ctx);
10578
10579 return true;
10580}
10581
10582int llama_eval(
10583 struct llama_context * ctx,

Callers 1

mainFunction · 0.50

Calls 3

write_u32Method · 0.45
write_rawMethod · 0.45

Tested by

no test coverage detected