From 816ef4ddc6eec81cc274587c40be7cb18357a8d5 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Fri, 9 Oct 2026 15:18:03 -0700 Subject: [PATCH] llm, simplify Continue config, add a function for pulling the LLMs outside of Ansible, adjust ollama settings. --- tasks/workstation/linux/software/llm.yml | 62 +++++++++++++++++------- 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/tasks/workstation/linux/software/llm.yml b/tasks/workstation/linux/software/llm.yml index d7e5f66..328a548 100644 --- a/tasks/workstation/linux/software/llm.yml +++ b/tasks/workstation/linux/software/llm.yml @@ -33,7 +33,7 @@ zerocode: zerocode qwen_code: qwen-code # Good to keep low to prevent swap usage. - llm_concurrency: "{{ ansible_memtotal_mb / 64000 | round(0, method='ceil') | int }}" + llm_concurrency: "{{ ansible_memtotal_mb / 64000 | round(0, method='ceil') | int }}" # Allow having multiple chats open without them just waiting each other. llm_parallel: "{{ ansible_processor_vcpus / 8 | round(0, method='ceil') | int }}" # Most LLMs take a coefficient of about 1.2 to 1.5 of their file size in @@ -186,10 +186,10 @@ exec 2>&1 export HOME={{ user_user.home }} # Timeouts # - export OLLAMA_LOAD_TIMEOUT=30m # default is 5m + export OLLAMA_LOAD_TIMEOUT=20m # default is 5m export OLLAMA_REQUEST_TIMEOUT=3600 # default 300 (unconfirmed, not in the list of --help vars) # Resource Usage # - export OLLAMA_KEEP_ALIVE=20m # default 5m + export OLLAMA_KEEP_ALIVE=20m # default is 5m export OLLAMA_MAX_LOADED_MODELS={{ llm_concurrency }} # default is 3 if using CPUs, or 3 * NumGPUs export OLLAMA_NUM_PARALLEL={{ llm_parallel }} # default is 1 and applies per-model (unconfirmed) export OLLAMA_CONTEXT_LENGTH={{ llm_context }} # default is 4096, https://docs.ollama.com/faq#how-can-i-specify-the-context-window-size @@ -323,6 +323,42 @@ # create: false # backup: true + + - name: Workstation | Linux | Software | LLMs | Models | ollama | Manual Script + ansible.builtin.blockinfile: + path: "{{ user_user.home }}/{{ item }}" + marker: "# {mark} ANSIBLE MANAGED BLOCK | ollama | Manual Script" + content: | + function pull_llms() { + echo "Manually Pulling Models" + {% for llm in llm_installs %} + + echo -e "\n\n Starting {{ llm.model }} \n\n" + ollama pull {{ llm.model }} || { + status=$? + echo "ERROR: Pull failed with status $status, exiting." + exit $status + } + {% endfor %} + echo "Done!!" + } + alias pull-llms="pull_llms " + alias pull-models="pull_llms " + alias pull-ai="pull_llms " + state: present + create: false + backup: true + loop: + - .bashrc + - .zshrc + + - name: Workstation | Linux | Software | LLMs | Models | ollama | Manual Script | Message + ansible.builtin.debug: + msg: | + The next task may take hours, if not days. if you'd a status bar, + I highly recommed reloading your RC file and running `pull-models`. + That will give you a much better idea of what's going on. + - name: Workstation | Linux | Software | LLMs | Models | ollama | Install ansible.builtin.shell: | set -o pipefail @@ -391,24 +427,14 @@ version: 1.0.0 schema: v1 models: - mode: "0644" - - - name: Workstation | Linux | Software | LLMs | Models | Continue | Models - ansible.builtin.blockinfile: - path: "{{ user_user.home }}/.continue/config.yml" - marker: "# {mark} ANSIBLE MANAGED BLOCK | llm.yml | Continue" - insertafter: EOF - block: | - {% for llm in llm_installs %} - - name: llm.provider + {% for llm in llm_installs %} + - name: {{ llm.provider }} provider: ollama - model: llm.model + model: {{ llm.model }} defaultCompletionOptions: contextLength: {{ llm_context }} maxTokens: {{ llm_context }} - {% endfor %} - state: present - create: false - backup: true + {% endfor %} + mode: "0644" when: ansible_pkg_mgr == "pacman"