From 92be32345a2a60885815134f1852cac6ae13f9b3 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Wed, 21 Oct 2026 04:51:46 -0700 Subject: [PATCH] llm, add context param to ollama_threads. --- tasks/workstation/linux/software/llm.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tasks/workstation/linux/software/llm.yml b/tasks/workstation/linux/software/llm.yml index 2793bff..4545e20 100644 --- a/tasks/workstation/linux/software/llm.yml +++ b/tasks/workstation/linux/software/llm.yml @@ -909,12 +909,20 @@ alias model-sizes="ollama_sizes " function ollama_threads() { + # VAR1 - Model model="$1" if [[ -z $model ]]; then model="qwen3.5:4b" fi - #echo " Stopping all ollama usage..." + # VAR2 - Context + typeset -i num_ctx="$2" + context="" + if [[ -n $num_ctx ]]; then + context=',"num_ctx":'$num_ctx'' + fi + + echo " Stopping all ollama usage..." sudo sv restart ollama >/dev/null 2>&1 # Benchmark Thread Count @@ -922,7 +930,7 @@ echo -n "`date` - Model $model w/ $t Thread(s), tokens/sec: " speed=$(curl -s http://localhost:11434/api/generate \ - -d '{"model":"'$model'","prompt":"Hello","stream":false,"keep_alive":1,"options":{"num_thread":'$t'}}' \ + -d '{"model":"'$model'","prompt":"Hello","stream":false,"keep_alive":1,"options":{"num_thread":'$t'$context}}' \ | jq '.eval_count * 1000000000 / .eval_duration' ) ctx="`ollama ps | grep $model | awk '{print $7}'`"