diff --git a/local.yml b/local.yml index 0c277eb..4ad7621 100644 --- a/local.yml +++ b/local.yml @@ -131,7 +131,7 @@ - ansible.builtin.include_tasks: tasks/workstation/linux/software/docker.yml - - ansible.builtin.include_tasks: tasks/workstation/linux/software/llm.yml + - ansible.builtin.include_tasks: tasks/workstation/linux/software/ai/llm.yml when: ansible_system == "Linux" and internet diff --git a/tasks/workstation/linux/software/llm.md b/tasks/workstation/linux/software/ai/README.md similarity index 100% rename from tasks/workstation/linux/software/llm.md rename to tasks/workstation/linux/software/ai/README.md diff --git a/tasks/workstation/linux/software/llm.yml b/tasks/workstation/linux/software/ai/llm.yml similarity index 98% rename from tasks/workstation/linux/software/llm.yml rename to tasks/workstation/linux/software/ai/llm.yml index ca0118c..5b6ab66 100644 --- a/tasks/workstation/linux/software/llm.yml +++ b/tasks/workstation/linux/software/ai/llm.yml @@ -66,7 +66,15 @@ # Also setting this to a minimum of 3 for using Codium with extensions. # 20261014: Going down to 1 since only using CPUs, no GPUs. Otherwise # the models seem to take excessively long to answer even small things. - llm_parallel: 1 #"{{ [(ansible_processor_vcpus / 2) | round(0, method='ceil'), 3] | max | int }}" + #llm_parallel: 1 #"{{ [(ansible_processor_vcpus / 2) | round(0, method='ceil'), 3] | max | int }}" + # 20261027 Increased to 3 as a maximum. + # After more research, this is a more memory-based parameter. Basically + # the model allocates this number of KV caches, that way when it is + # running in multiple chats it does not need to drop context and reload. + # Still only uses X threads for all chats, but does not waste much time. + # So if set to 3, and doing 64K context, it really allocates 192k in RAM + # and supposedly if only doing 1 chat the model can use it all. + llm_parallel: "{{ [(ansible_memtotal_mb / 8000) | round(0, method='floor'), 3] | min | int }}" # Most LLMs take a coefficient of about 1.2 to 1.5 of their file size in # RAM, which is usually less than guessing a usage of weight*1000. # Example: @@ -272,7 +280,7 @@ ### Resource Usage ### export OLLAMA_KEEP_ALIVE=-1 # default is 5m. Good frontends keep the model alive as long as it needs to be, this is not a source of timeout. 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_NUM_PARALLEL={{ llm_parallel }} # default is 1 and applies per-model export OLLAMA_CONTEXT_LENGTH={{ llm_context }} # default is 4096, https://docs.ollama.com/faq#how-can-i-specify-the-context-window-size export OLLAMA_MAX_QUEUE=999 # default is 512 (unconfirmed) export OLLAMA_NUM_THREADS={{ (ansible_processor_vcpus / 2) | int }} # not real, but maybe some day. diff --git a/tasks/workstation/linux/software/hugo.yml b/tasks/workstation/linux/software/hugo.yml index 5b843af..f0411ac 100644 --- a/tasks/workstation/linux/software/hugo.yml +++ b/tasks/workstation/linux/software/hugo.yml @@ -5,52 +5,73 @@ - name: Workstation | Linux | Software | Hugo block: - - name: Workstation | Linux | Software | Hugo | pacman - block: + - name: Workstation | Linux | Software | Hugo | pacman + block: - - name: Workstation | Linux | Software | Hugo | pacman | Facts - ansible.builtin.set_fact: - sass_old: ruby-sass - sass_current: dart-sass + - name: Workstation | Linux | Software | Hugo | pacman | Facts + ansible.builtin.set_fact: + sass_old: ruby-sass + sass_current: dart-sass - - name: Workstation | Linux | Software | Hugo | pacman | Remove Old - ansible.builtin.package: - name: - - "{{ sass_old }}" - state: absent + - name: Workstation | Linux | Software | Hugo | pacman | Remove Old + ansible.builtin.package: + name: + - "{{ sass_old }}" + state: absent - - name: Workstation | Linux | Software | Hugo | pacman | Install New - ansible.builtin.package: - name: - - "{{ sass_current }}" - state: present + - name: Workstation | Linux | Software | Hugo | pacman | Install New + ansible.builtin.package: + name: + - hugo + - "{{ sass_current }}" + state: present - when: ansible_pkg_mgr == "pacman" + when: ansible_pkg_mgr == "pacman" - # This must exist after nodejs.yml so that NPM is installed. - - name: Workstation | Linux | Software | Hugo | npm - block: + # This must exist after nodejs.yml so that NPM is installed. + - name: Workstation | Linux | Software | Hugo | apt + block: - - name: Workstation | Linux | Software | Hugo | npm | Facts - ansible.builtin.set_fact: - sass_old: node-sass - sass_current: sass + - name: Workstation | Linux | Software | Hugo | apt | sass | Facts + ansible.builtin.set_fact: + sass_old: node-sass + sass_current: sass - - name: Workstation | Linux | Software | Hugo | npm | Gather - ansible.builtin.shell: npm prefix -g - register: npm_bin_dir # Provides /usr/local/ on Devuan, /usr/ on Artix. - changed_when: false + - name: Workstation | Linux | Software | Hugo | apt | sass | Gather + ansible.builtin.shell: npm prefix -g + register: npm_bin_dir # Provides /usr/local/ on Devuan, /usr/ on Artix. + changed_when: false - - name: Workstation | Linux | Software | Hugo | npm | Remove Old - ansible.builtin.shell: "npm remove -g {{ sass_old }}" - args: - creates: "{{ npm_bin_dir.stdout }}/bin/sass" + - name: Workstation | Linux | Software | Hugo | apt | sass | Remove Old + ansible.builtin.shell: "npm remove -g {{ sass_old }}" + args: + creates: "{{ npm_bin_dir.stdout }}/bin/sass" - - name: Workstation | Linux | Software | Hugo | npm | Install New - ansible.builtin.shell: "npm install -g {{ sass_current }}" - args: - creates: "{{ npm_bin_dir.stdout }}/bin/sass" + - name: Workstation | Linux | Software | Hugo | apt | sass | Install New + ansible.builtin.shell: "npm install -g {{ sass_current }}" + args: + creates: "{{ npm_bin_dir.stdout }}/bin/sass" - when: ansible_pkg_mgr == "apt" + - name: Workstation | Linux | Software | Hugo | apt | hugo | Remove Old + ansible.builtin.package: + name: + - hugo + state: absent + + - name: Workstation | Linux | Software | Hugo | apt | hugo | Install Dependencies + ansible.builtin.package: + name: + - golang + - gcc + state: present + + - name: Workstation | Linux | Software | Hugo | apt | hugo | Build + ansible.builtin.shell: | + CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@latest + ln -s $HOME/go/bin/hugo /usr/local/bin/hugo + register: shell_check + changed_when: shell_check.rc == 0 + + when: ansible_pkg_mgr == "apt" when: coding is true diff --git a/test.yml b/test.yml index 8863c67..a076969 100644 --- a/test.yml +++ b/test.yml @@ -28,7 +28,7 @@ ansible.builtin.include_tasks: tasks/workstation/linux/software/docker.yml - name: LLM - ansible.builtin.include_tasks: tasks/workstation/linux/software/llm.yml + ansible.builtin.include_tasks: tasks/workstation/linux/software/ai/llm.yml ####################### #######################