| 10561 | } |
| 10562 | |
| 10563 | bool 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 | |
| 10582 | int llama_eval( |
| 10583 | struct llama_context * ctx, |
no test coverage detected