aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgi Gerganov <ggerganov@gmail.com>2023-03-22 07:45:00 +0200
committerGeorgi Gerganov <ggerganov@gmail.com>2023-03-22 07:45:14 +0200
commit928480ef5b7b03d7a07e98286aebe3d8b24457d9 (patch)
tree969ae89f58e688971bbefc182f70f6745db8e4df
parent56817b1f882b1894daa4051d0de0bf9a0926d315 (diff)
Init llama_context_params properly from CLI (#370)
-rw-r--r--llama.cpp4
-rw-r--r--main.cpp5
2 files changed, 8 insertions, 1 deletions
diff --git a/llama.cpp b/llama.cpp
index 08dfcb3..fde4d25 100644
--- a/llama.cpp
+++ b/llama.cpp
@@ -1398,6 +1398,10 @@ struct llama_context * llama_init_from_file(
llama_context * ctx = new llama_context;
+ if (params.seed <= 0) {
+ params.seed = time(NULL);
+ }
+
ctx->rng = std::mt19937(params.seed);
ctx->logits_all = params.logits_all;
diff --git a/main.cpp b/main.cpp
index 7db3df7..b98c9e2 100644
--- a/main.cpp
+++ b/main.cpp
@@ -194,7 +194,10 @@ int main(int argc, char ** argv) {
{
auto lparams = llama_context_default_params();
- lparams.f16_kv = params.memory_f16;
+ lparams.n_ctx = params.n_ctx;
+ lparams.n_parts = params.n_parts;
+ lparams.seed = params.seed;
+ lparams.f16_kv = params.memory_f16;
lparams.logits_all = params.perplexity;
ctx = llama_init_from_file(params.model.c_str(), lparams);