From 314ce7d1cc89e52c1f44d46b21b1282574319296 Mon Sep 17 00:00:00 2001 From: Andrei Betlen Date: Sat, 8 Apr 2023 19:54:04 -0400 Subject: [PATCH] Fix cpu count default --- llama_cpp/llama.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llama_cpp/llama.py b/llama_cpp/llama.py index c964938..bd8f49f 100644 --- a/llama_cpp/llama.py +++ b/llama_cpp/llama.py @@ -74,7 +74,7 @@ class Llama: self.tokens_consumed = 0 self.n_batch = min(n_ctx, n_batch) - self.n_threads = n_threads or multiprocessing.cpu_count() + self.n_threads = n_threads or max(multiprocessing.cpu_count() // 2, 1) if not os.path.exists(model_path): raise ValueError(f"Model path does not exist: {model_path}")