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}'`"