aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorJustin Suess <justin.suess@westpoint.edu>2023-03-15 15:42:40 -0400
committerGitHub <noreply@github.com>2023-03-15 21:42:40 +0200
commit2d64715ad475f192a4004a52d134c67ccb6f44ad (patch)
tree1809c957a8cd0b7fd530e18288ed2d925041218a /main.cpp
parent16b2c61a22f828ea77d9f084ca871c63bc5cc283 (diff)
added ctx_size parameter (#148)
* added ctx_size parameter * added it in more places * Apply suggestions from code review --------- Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/main.cpp b/main.cpp
index 6227db6..dcc42af 100644
--- a/main.cpp
+++ b/main.cpp
@@ -547,6 +547,8 @@ bool llama_eval(
const int d_key = n_embd/n_head;
+ // TODO: check if this size scales with n_ctx linearly and remove constant. somehow I feel it wasn't the case
+ // static size_t buf_size = hparams.n_ctx*1024*1024;
static size_t buf_size = 512u*1024*1024;
static void * buf = malloc(buf_size);
@@ -819,8 +821,7 @@ int main(int argc, char ** argv) {
// load the model
{
const int64_t t_start_us = ggml_time_us();
-
- if (!llama_model_load(params.model, model, vocab, 512)) { // TODO: set context from user input ??
+ if (!llama_model_load(params.model, model, vocab, params.n_ctx)) {
fprintf(stderr, "%s: failed to load model from '%s'\n", __func__, params.model.c_str());
return 1;
}