forked from abetlen/llama-cpp-python
-
Notifications
You must be signed in to change notification settings - Fork 66
130 lines (113 loc) · 4.24 KB
/
Copy pathtest.yaml
File metadata and controls
130 lines (113 loc) · 4.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Tests
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
# Auto-cancel stale runs on the same PR/branch
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
TRANSFORMER_REVISION: 9217f5db79a29953eb74d5343926648285ec7e67
HYBRID_REVISION: b0f773d6323ab08f262f88f53f73a8d869b59635
jobs:
prepare-models:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Cache test models
id: models
uses: actions/cache@v5
with:
path: test-models
key: test-models-q8proj-v1-${{ env.TRANSFORMER_REVISION }}-${{ env.HYBRID_REVISION }}
- name: Install download dependency
if: steps.models.outputs.cache-hit != 'true'
run: python -m pip install huggingface-hub
- name: Download pinned models once
if: steps.models.outputs.cache-hit != 'true'
shell: python
run: |
import os
from huggingface_hub import hf_hub_download
models = [
("Qwen/Qwen2.5-0.5B-Instruct-GGUF",
"qwen2.5-0.5b-instruct-q4_k_m.gguf", os.environ["TRANSFORMER_REVISION"]),
("JamePeng2023/Qwen3.5-0.8B-GGUF",
"Qwen3.5-0.8B-Q4_K_M.gguf", os.environ["HYBRID_REVISION"]),
("JamePeng2023/Qwen3.5-0.8B-GGUF",
"mmproj-Qwen3.5-0.8b-Q8_0.gguf", os.environ["HYBRID_REVISION"]),
]
for repo, filename, revision in models:
hf_hub_download(repo, filename, revision=revision, local_dir="test-models")
- name: Share models with all test environments
uses: actions/upload-artifact@v4
with:
name: test-models
path: test-models/*.gguf
if-no-files-found: error
compression-level: 0
retention-days: 3
# Combined job for Linux, Windows, and Apple Silicon macOS
build-and-test:
needs: prepare-models
env:
LLAMA_TEST_TRANSFORMER_MODEL: ${{ github.workspace }}/test-models/qwen2.5-0.5b-instruct-q4_k_m.gguf
LLAMA_TEST_HYBRID_MODEL: ${{ github.workspace }}/test-models/Qwen3.5-0.8B-Q4_K_M.gguf
LLAMA_TEST_MMPROJ: ${{ github.workspace }}/test-models/mmproj-Qwen3.5-0.8b-Q8_0.gguf
runs-on: ${{ matrix.os }}
strategy:
# Don't cancel other jobs in the matrix if one fails
fail-fast: false
matrix:
os: [ubuntu-latest, windows-2022]
python-version: ["3.9", "3.14"]
include:
# Apple Silicon macOS with Metal
- os: macos-26
python-version: "3.9"
cmake_args: "-DGGML_METAL_EMBED_LIBRARY=off -DGGML_RPC=on"
metal_status: "(Metal)"
- os: macos-26
python-version: "3.14"
cmake_args: "-DGGML_METAL_EMBED_LIBRARY=off -DGGML_RPC=on"
metal_status: "(Metal)"
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: "recursive"
- name: Install the latest version of uv and set the python version
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Download prepared test models
uses: actions/download-artifact@v5
with:
name: test-models
path: test-models
- name: Install dependencies and Build
env:
CMAKE_ARGS: ${{ matrix.cmake_args }}
run: |
echo "Building with CMAKE_ARGS: $CMAKE_ARGS"
uv pip install --system -e .[all] --verbose
shell: bash
- name: System Info and llama-cpp-python version
run: |
python -c "import platform; print('Machine:', platform.machine(), 'Arch:', platform.architecture())"
if [[ "${{ runner.os }}" == "macOS" ]]; then
sysctl -n machdep.cpu.brand_string
fi
python -c "import llama_cpp; print('llama_cpp_python:', llama_cpp.__version__)"
shell: bash
- name: Test with pytest by python ${{ matrix.python-version }}
run: python -m pytest
shell: bash