]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
Default to 4 threads (#243)
authorGeorgi Gerganov <redacted>
Fri, 17 Mar 2023 19:46:46 +0000 (21:46 +0200)
committerGeorgi Gerganov <redacted>
Fri, 17 Mar 2023 19:46:46 +0000 (21:46 +0200)
utils.h

diff --git a/utils.h b/utils.h
index 5e5b40ffae35cef7021d61b890428a3e137fdb6d..c1a8498a78d68dfdfd2fbffb69f4cd8187823827 100644 (file)
--- a/utils.h
+++ b/utils.h
 
 struct gpt_params {
     int32_t seed      = -1; // RNG seed
-    int32_t n_threads;
+    int32_t n_threads = std::min(4, (int32_t) std::thread::hardware_concurrency());
     int32_t n_predict = 128; // new tokens to predict
     int32_t repeat_last_n = 64;  // last n tokens to penalize
     int32_t n_ctx = 512; //context size
-    
+
     // sampling parameters
     int32_t top_k = 40;
     float   top_p = 0.95f;