Skip to content

Usage of n_ctx - 4 in examples/main/main.cpp #7161

Closed Answered by ggerganov
danbev asked this question in Q&A
Discussion options

You must be logged in to vote

It refers to this code:

https://github.com/ggerganov/llama.cpp/blob/07cd41d0965829463eff73eda3348aedbfd3a444/examples/main/main.cpp#L291-L296

The n_ctx - 4 is arbitrary - the goal is to leave at least some context for the generation because if the prompt fills the entire context then we can't generate new tokens

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@danbev
Comment options

danbev May 9, 2024
Collaborator Author

Answer selected by danbev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants