restored save load state example
This commit is contained in:
parent
cffe923ea3
commit
30144f7634
1 changed files with 4 additions and 3 deletions
|
@ -67,9 +67,10 @@ int main(int argc, char ** argv) {
|
||||||
|
|
||||||
// Save state (rng, logits, embedding and kv_cache) to file
|
// Save state (rng, logits, embedding and kv_cache) to file
|
||||||
{
|
{
|
||||||
llama_file file("dump_state.bin", "wb");
|
FILE *fp_write = fopen("dump_state.bin", "wb");
|
||||||
llama_data_file_context data_ctx(&file);
|
llama_copy_state_data(ctx, state_mem); // could also copy directly to memory mapped file
|
||||||
llama_copy_state_data(ctx, &data_ctx); // can also copy to memory buffer
|
fwrite(state_mem, 1, state_size, fp_write);
|
||||||
|
fclose(fp_write);
|
||||||
}
|
}
|
||||||
|
|
||||||
// save state (last tokens)
|
// save state (last tokens)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue