forked from JamePeng/llama-cpp-python
-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (100 loc) · 3.32 KB
/
Copy pathtest.yaml
File metadata and controls
117 lines (100 loc) · 3.32 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
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:
REPO_ID: Qwen/Qwen2-0.5B-Instruct-GGUF
MODEL_FILE: qwen2-0_5b-instruct-q8_0.gguf
jobs:
# Combined job for Linux, Windows, and macOS (non-Metal)
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
# Don't cancel other jobs in the matrix if one fails
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-14]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Cache HuggingFace model
id: model-cache
uses: actions/cache@v4
with:
path: ~/.cache/huggingface/hub
key: ${{ runner.os }}-model-${{ env.REPO_ID }}-${{ env.MODEL_FILE }}
- name: Download model if not cached
# Only run this step if the cache was not found
if: steps.model-cache.outputs.cache-hit != 'true'
run: |
pip install huggingface-hub
hf download ${{ env.REPO_ID }} ${{ env.MODEL_FILE }}
shell: bash
- name: Install dependencies
env:
CMAKE_ARGS: ${{ runner.os == 'macOS' && '-DLLAMA_METAL=off' || '' }}
run: |
python -m pip install --upgrade pip
python -m pip install uv
python -m uv pip install -e .[all] --verbose
shell: bash
- name: Test with pytest
run: python -m pytest
shell: bash
# Dedicated job for macOS with Metal support
build-macos-metal:
runs-on: macos-14
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: 'pip'
- name: System Info
run: |
uname -a
sysctl -n machdep.cpu.brand_string
python -c "import platform; print(platform.machine(), platform.architecture())"
shell: bash
- name: Cache HuggingFace model
id: model-cache
uses: actions/cache@v4
with:
path: ~/.cache/huggingface/hub
key: ${{ runner.os }}-metal-model-${{ env.REPO_ID }}-${{ env.MODEL_FILE }}
- name: Download model if not cached
# Only run this step if the cache was not found
if: steps.model-cache.outputs.cache-hit != 'true'
run: |
pip install huggingface-hub
hf download ${{ env.REPO_ID }} ${{ env.MODEL_FILE }}
shell: bash
- name: Install dependencies (macOS Metal)
run: |
python -m pip install --upgrade pip
python -m pip install uv
CMAKE_ARGS="-DLLAMA_METAL=on -DGGML_METAL_USE_BF16=on -DGGML_METAL_EMBED_LIBRARY=on" python -m uv pip install -e .[all] --verbose
shell: bash
- name: Test with pytest
run: python -m pytest
shell: bash