Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
llama_load_session_file
andllama_save_session_file
definitions in the correct place inllama.cpp
🤖 Generated by Copilot at c0335b5
Summary
🐛🗂️♻️
This pull request enhances the llama library and its example program. It implements a new session file format for llama and updates the
llama.h
andllama.cpp
files accordingly. It also improves the code quality and functionality of themain.cpp
example.Walkthrough
llama_load_session_file
andllama_save_session_file
to handle session data with a new file format and more error checking (link, link)llama_load_session_file
andllama_save_session_file
that used a different file format and had less error handling (link)LLAMA_SESSION_MAGIC
andLLAMA_SESSION_VERSION
for the session file format and change existing macrosLLAMA_FILE_MAGIC
andLLAMA_FILE_MAGIC_UNVERSIONED
to use character literals (link)examples/main/main.cpp
where the number of generated tokens was not counted correctly and could cause an infinite loop or a wrong output (link)examples/main/main.cpp
when loading a session file, and use a boolean check instead of the function return value (link)path_session
variable in the message inexamples/main/main.cpp
for consistency and clarity (link)examples/main/main.cpp
for coding style and readability (link)examples/main/main.cpp
as the decision to stop saving the session when the context is exhausted seems final (link)