8000 Safer calculation of default n_threads · hrubanj/llama-cpp-python@da539cc · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit da539cc

Browse files
committed
Safer calculation of default n_threads
1 parent 9b75268 commit da539cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llama_cpp/server/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Settings(BaseSettings):
2828
model: str
2929
n_ctx: int = 2048
3030
n_batch: int = 8
31-
n_threads: int = int(os.cpu_count() / 2) or 1
31+
n_threads: int = ((os.cpu_count() or 2) // 2) or 1
3232
f16_kv: bool = True
3333
use_mlock: bool = False # This causes a silent failure on platforms that don't support mlock (e.g. Windows) took forever to figure out...
3434
embedding: bool = True

0 commit comments

Comments
 (0)
0