Initial snapshot before transformerlab recovery
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
- name: Clone llama.cpp
|
||||
git:
|
||||
repo: "https://github.com/ggml-org/llama.cpp.git"
|
||||
dest: "{{ courseware_repos_dir }}/llama.cpp"
|
||||
version: "{{ courseware_llama_cpp_commit }}"
|
||||
update: false
|
||||
|
||||
- name: Check for CUDA compiler on Linux
|
||||
command: which nvcc
|
||||
register: courseware_llama_nvcc
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
when: ansible_system == "Linux"
|
||||
|
||||
- name: Check for CUDA runtime header on Linux
|
||||
stat:
|
||||
path: "{{ item }}"
|
||||
loop:
|
||||
- /usr/local/cuda/include/cuda_runtime.h
|
||||
- /usr/include/cuda_runtime.h
|
||||
register: courseware_llama_cuda_headers
|
||||
when: ansible_system == "Linux"
|
||||
|
||||
- name: Fail early when CUDA toolkit is missing on Linux/WSL
|
||||
fail:
|
||||
msg: |
|
||||
CUDA Toolkit is not installed inside this Linux environment.
|
||||
|
||||
`nvidia-smi` only proves that the NVIDIA driver is visible. It does not provide the Linux-side CUDA development toolkit needed to build CUDA-enabled llama.cpp.
|
||||
|
||||
If you are using WSL, this is the common split:
|
||||
- Windows side: NVIDIA driver exposes the GPU to WSL
|
||||
- Linux side: CUDA toolkit still must exist inside the distro
|
||||
|
||||
Fix it, then rerun:
|
||||
bash deploy-courseware.sh
|
||||
|
||||
First try:
|
||||
sudo apt update
|
||||
sudo apt install -y nvidia-cuda-toolkit
|
||||
|
||||
If that package is unavailable in your distro:
|
||||
1. add NVIDIA's CUDA apt repository for your Debian/Ubuntu release
|
||||
2. install the CUDA toolkit from that repository
|
||||
|
||||
Verify with:
|
||||
nvcc --version
|
||||
ls /usr/local/cuda/include/cuda_runtime.h
|
||||
when:
|
||||
- ansible_system == "Linux"
|
||||
- courseware_llama_nvcc.rc != 0 or (courseware_llama_cuda_headers.results | selectattr('stat.exists', 'equalto', true) | list | length == 0)
|
||||
|
||||
- name: Set llama.cpp backend flag
|
||||
set_fact:
|
||||
courseware_llama_backend_flag: "{{ '-DGGML_METAL=ON' if ansible_system == 'Darwin' else '-DGGML_CUDA=ON' }}"
|
||||
|
||||
- name: Configure llama.cpp
|
||||
command:
|
||||
argv:
|
||||
- cmake
|
||||
- -S
|
||||
- "{{ courseware_repos_dir }}/llama.cpp"
|
||||
- -B
|
||||
- "{{ courseware_repos_dir }}/llama.cpp/build"
|
||||
- -DCMAKE_BUILD_TYPE=Release
|
||||
- "{{ courseware_llama_backend_flag }}"
|
||||
args:
|
||||
creates: "{{ courseware_repos_dir }}/llama.cpp/build/CMakeCache.txt"
|
||||
|
||||
- name: Build llama.cpp tools
|
||||
command:
|
||||
argv:
|
||||
- cmake
|
||||
- --build
|
||||
- "{{ courseware_repos_dir }}/llama.cpp/build"
|
||||
- --target
|
||||
- llama-cli
|
||||
- llama-quantize
|
||||
- llama-perplexity
|
||||
- llama-server
|
||||
- -j
|
||||
|
||||
- name: Check system PATH slots for llama.cpp tools
|
||||
stat:
|
||||
path: "/usr/local/bin/{{ item }}"
|
||||
follow: false
|
||||
loop:
|
||||
- llama-cli
|
||||
- llama-quantize
|
||||
- llama-perplexity
|
||||
- llama-server
|
||||
register: courseware_llama_path_slots
|
||||
when: ansible_system == "Linux"
|
||||
|
||||
- name: Link llama.cpp tools into /usr/local/bin
|
||||
become: true
|
||||
file:
|
||||
src: "{{ courseware_llama_cpp_bin_dir }}/{{ item.item }}"
|
||||
dest: "/usr/local/bin/{{ item.item }}"
|
||||
state: link
|
||||
force: true
|
||||
loop: "{{ courseware_llama_path_slots.results | default([]) }}"
|
||||
when:
|
||||
- ansible_system == "Linux"
|
||||
- not item.stat.exists or item.stat.islnk
|
||||
- not item.stat.exists or item.stat.lnk_source == (courseware_llama_cpp_bin_dir ~ '/' ~ item.item)
|
||||
Reference in New Issue
Block a user