From d19dd085f5dfcfa5157a6c9a6f9398868e39e539 Mon Sep 17 00:00:00 2001 From: Ayo Date: Sun, 24 Aug 2025 10:04:12 +0200 Subject: [PATCH] feat(ai): add brainstorm model & script to unload model from memory --- ai-brainstorm.sh | 17 +++++++++++++++++ ai-coder.sh | 11 ++++++----- ai.sh | 38 +++++++++++++++++++++++++++++--------- ayo.sh | 3 +++ display.sh | 2 +- 5 files changed, 56 insertions(+), 15 deletions(-) create mode 100644 ai-brainstorm.sh diff --git a/ai-brainstorm.sh b/ai-brainstorm.sh new file mode 100644 index 0000000..49074b0 --- /dev/null +++ b/ai-brainstorm.sh @@ -0,0 +1,17 @@ +model=brainstorm:8b + +if ! [ "$2" = "" ]; then + if [ "$2" = "sleep" ]; then + ollama stop $model + else + start_time=$(date +%s%N) + ollama run $model "$@" + end_time=$(date +%s%N) + duration=$((end_time - start_time)) + duration_ms=$(echo "scale=3; $duration / 1000000" | bc) + duration_s=$(echo "scale=3; $duration_ms / 1000" | bc) + echo "Model $model took $duration_s s" + fi +else + ollama run $model +fi diff --git a/ai-coder.sh b/ai-coder.sh index 7d2012d..d55e2d2 100644 --- a/ai-coder.sh +++ b/ai-coder.sh @@ -1,10 +1,11 @@ -# Load config -. ${HOME}/ayo.conf - -model=qwen3-coder:30b +model=coder:30b if ! [ "$2" = "" ]; then - ollama run $model "%coder_prompt...

beginning prompt...
$@" --hidethinking + if [ "$2" = "sleep" ]; then + ollama stop $model + else + ollama run $model "$@" --hidethinking + fi else ollama run $model --hidethinking fi diff --git a/ai.sh b/ai.sh index 282d1d2..5e271da 100644 --- a/ai.sh +++ b/ai.sh @@ -1,17 +1,37 @@ -# Load config -. ${HOME}/ayo.conf - -# model=deepseek-r1:8b -model=qwen3-coder:30b +model=helper:8b if ! [ "$2" = "" ]; then - if [ "$2" = "wake" ]; then + if [ "$2" = "open-webui" ]; then + . $HOME/open-webui/.venv/bin/activate + open-webui serve + python --version + deactivate + + elif [ "$2" = "wake" ]; then . $HOME/llm_env/bin/activate - . $HOME/llama-cpp/env.conf - . $HOME/intel/oneapi/setvars.sh + + export OLLAMA_NUM_GPU=999 + export no_proxy=localhost,127.0.0.1 + export ZES_ENABLE_SYSMAN=1 + source $HOME/intel/oneapi/setvars.sh + export SYCL_CACHE_PERSISTENT=1 + $HOME/llama-cpp/ollama serve + python --version + deactivate + + echo $ZES_ENABLE_SYSMAN + echo $SYCL_CACHE_PERSISTENT + elif [ "$2" = "sleep" ]; then + ollama stop $model else - ollama run $model "$chat_prompt...

beginning prompt...
$@" --hidethinking + start_time=$(date +%s%N) + ollama run $model "$@" --hidethinking + end_time=$(date +%s%N) + duration=$((end_time - start_time)) + duration_ms=$(echo "scale=3; $duration / 1000000" | bc) + duration_s=$(echo "scale=3; $duration_ms / 1000" | bc) + echo "Model $model took $duration_s s" fi else ollama run $model --hidethinking diff --git a/ayo.sh b/ayo.sh index 4280c1e..7c8067f 100755 --- a/ayo.sh +++ b/ayo.sh @@ -70,6 +70,9 @@ case $1 in ## SCRIPTS + ai-brainstorm) + . ${scripts_dir}/ai-brainstorm.sh "$@" + ;; ai-coder) . ${scripts_dir}/ai-coder.sh "$@" ;; diff --git a/display.sh b/display.sh index 5b1b30e..9a9aefd 100755 --- a/display.sh +++ b/display.sh @@ -42,7 +42,7 @@ function main() { } start_time=$(date +%s%N) -main +main $@ end_time=$(date +%s%N) duration=$((end_time - start_time)) duration_ms=$(echo "scale=3; $duration / 1000000" | bc)