diff options
-rw-r--r-- | examples/common.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/examples/common.cpp b/examples/common.cpp index 5608ca8..7a1928f 100644 --- a/examples/common.cpp +++ b/examples/common.cpp @@ -117,6 +117,9 @@ bool gpt_params_parse(int argc, char ** argv, gpt_params & params) { break; } params.n_threads = std::stoi(argv[i]); + if (params.n_threads <= 0) { + params.n_threads = std::thread::hardware_concurrency(); + } } else if (arg == "-p" || arg == "--prompt") { if (++i >= argc) { invalid_param = true; |