Skip to content

Commit c9e955c

Browse files
committed
Merge main into tojson-unicode
2 parents cbe1129 + 5848020 commit c9e955c

54 files changed

Lines changed: 6583 additions & 4045 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-and-release.yaml

Lines changed: 118 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14-
os: [ubuntu-20.04, windows-2019, macos-12]
14+
os: [ubuntu-22.04, windows-2022, macos-14, macos-15]
1515

1616
steps:
1717
- uses: actions/checkout@v4
@@ -21,18 +21,47 @@ jobs:
2121
# Used to host cibuildwheel
2222
- uses: actions/setup-python@v5
2323
with:
24-
python-version: "3.8"
24+
python-version: "3.9"
2525

26-
- name: Install dependencies
26+
- name: Install dependencies (Linux/MacOS)
27+
if: runner.os != 'Windows'
2728
run: |
2829
python -m pip install --upgrade pip
29-
python -m pip install -e .[all]
30+
python -m pip install uv
31+
RUST_LOG=trace python -m uv pip install -e .[all] --verbose
32+
shell: bash
33+
34+
- name: Install dependencies (Windows)
35+
if: runner.os == 'Windows'
36+
env:
37+
RUST_LOG: trace
38+
run: |
39+
python -m pip install --upgrade pip
40+
python -m pip install uv
41+
python -m uv pip install -e .[all] --verbose
42+
shell: cmd
3043

3144
- name: Build wheels
32-
uses: pypa/cibuildwheel@v2.20.0
45+
uses: pypa/cibuildwheel@v2.22.0
3346
env:
34-
# disable repair
47+
# Keep repair disabled by default for non-Linux platforms in this job.
3548
CIBW_REPAIR_WHEEL_COMMAND: ""
49+
# Linux needs auditwheel repair so manylinux and musllinux wheels are
50+
# published with distinct platform tags instead of generic linux tags.
51+
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "LD_LIBRARY_PATH=/project/llama_cpp/lib auditwheel repair -w {dest_dir} {wheel}"
52+
# The release wheel is tagged py3-none, so one build per platform
53+
# covers all supported Python versions and avoids duplicate names.
54+
CIBW_BUILD_LINUX: "cp38-*"
55+
CIBW_BUILD_MACOS: "cp39-*"
56+
CIBW_BUILD_WINDOWS: "cp39-*"
57+
# Skip cibuildwheel's default i686 sidecar and keep Linux release
58+
# wheels on a portable x86_64 CPU baseline.
59+
CIBW_ARCHS_LINUX: "auto64"
60+
CIBW_ARCHS_WINDOWS: "AMD64"
61+
CIBW_ENVIRONMENT_LINUX: CMAKE_ARGS="-DGGML_NATIVE=off"
62+
# Keep macOS release wheels on a portable CPU baseline instead of
63+
# inheriting the hosted runner's native flags.
64+
CIBW_ENVIRONMENT_MACOS: CMAKE_ARGS="-DGGML_NATIVE=off"
3665
with:
3766
package-dir: .
3867
output-dir: wheelhouse
@@ -44,7 +73,55 @@ jobs:
4473

4574
build_wheels_arm64:
4675
name: Build arm64 wheels
76+
runs-on: ubuntu-24.04-arm
77+
steps:
78+
- uses: actions/checkout@v4
79+
with:
80+
submodules: "recursive"
81+
82+
- name: Build wheels
83+
uses: pypa/cibuildwheel@v2.22.0
84+
env:
85+
CIBW_SKIP: "pp*"
86+
CIBW_REPAIR_WHEEL_COMMAND: "LD_LIBRARY_PATH=$PWD/llama_cpp/lib auditwheel repair -w {dest_dir} {wheel}"
87+
CIBW_ARCHS: "aarch64"
88+
# Keep native arm64 builds on a portable CPU baseline instead of
89+
# tuning wheels to the hosted runner.
90+
CIBW_ENVIRONMENT: CMAKE_ARGS="-DGGML_NATIVE=off"
91+
# The release wheel is tagged py3-none, so one build covers all
92+
# supported Python versions and avoids duplicate wheel names.
93+
CIBW_BUILD: "cp38-*"
94+
with:
95+
output-dir: wheelhouse
96+
97+
- name: Upload wheels as artifacts
98+
uses: actions/upload-artifact@v4
99+
with:
100+
name: wheels_arm64
101+
path: ./wheelhouse/*.whl
102+
103+
build_wheels_riscv64:
104+
name: Build riscv64 wheels (${{ matrix.shard.name }})
47105
runs-on: ubuntu-latest
106+
strategy:
107+
fail-fast: false
108+
matrix:
109+
shard:
110+
- name: cp310
111+
build: "cp310-*"
112+
artifact: wheels_riscv64_cp310
113+
- name: cp311
114+
build: "cp311-*"
115+
artifact: wheels_riscv64_cp311
116+
- name: cp312
117+
build: "cp312-*"
118+
artifact: wheels_riscv64_cp312
119+
- name: cp313
120+
build: "cp313-*"
121+
artifact: wheels_riscv64_cp313
122+
- name: cp314
123+
build: "cp314-*"
124+
artifact: wheels_riscv64_cp314
48125
steps:
49126
- uses: actions/checkout@v4
50127
with:
@@ -53,22 +130,27 @@ jobs:
53130
- name: Set up QEMU
54131
uses: docker/setup-qemu-action@v3
55132
with:
56-
platforms: linux/arm64
133+
platforms: linux/riscv64
57134

58135
- name: Build wheels
59-
uses: pypa/cibuildwheel@v2.20.0
136+
uses: pypa/cibuildwheel@v3.1.2
60137
env:
61138
CIBW_SKIP: "*musllinux* pp*"
62139
CIBW_REPAIR_WHEEL_COMMAND: ""
63-
CIBW_ARCHS: "aarch64"
64-
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*"
140+
CIBW_ARCHS: "riscv64"
141+
# Build riscv64 wheels against a conservative baseline instead of
142+
# enabling RVV-related extensions from the build container.
143+
CIBW_ENVIRONMENT: CMAKE_ARGS="-DGGML_NATIVE=off -DGGML_RVV=off -DGGML_RV_ZFH=off -DGGML_RV_ZVFH=off -DGGML_RV_ZICBOP=off -DGGML_RV_ZIHINTPAUSE=off"
144+
# Split the emulated riscv64 build into one Python version per job
145+
# to minimize wall-clock time without changing the release artifacts.
146+
CIBW_BUILD: ${{ matrix.shard.build }}
65147
with:
66148
output-dir: wheelhouse
67149

68150
- name: Upload wheels as artifacts
69151
uses: actions/upload-artifact@v4
70152
with:
71-
name: wheels_arm64
153+
name: ${{ matrix.shard.artifact }}
72154
path: ./wheelhouse/*.whl
73155

74156
build_sdist:
@@ -79,24 +161,44 @@ jobs:
79161
- uses: actions/checkout@v4
80162
with:
81163
submodules: "recursive"
164+
82165
- uses: actions/setup-python@v5
83166
with:
84-
python-version: "3.8"
85-
- name: Install dependencies
167+
python-version: "3.9"
168+
169+
- name: Install dependencies (Linux/MacOS)
170+
if: runner.os != 'Windows'
171+
run: |
172+
python -m pip install --upgrade pip
173+
python -m pip install uv
174+
RUST_LOG=trace python -m uv pip install -e .[all] --verbose
175+
python -m uv pip install build
176+
shell: bash
177+
178+
- name: Install dependencies (Windows)
179+
if: runner.os == 'Windows'
180+
env:
181+
RUST_LOG: trace
86182
run: |
87-
python -m pip install --upgrade pip build
88-
python -m pip install -e .[all]
183+
python -m pip install --upgrade pip
184+
python -m pip install uv
185+
python -m uv pip install -e .[all] --verbose
186+
python -m uv pip install build
187+
shell: cmd
188+
89189
- name: Build source distribution
90190
run: |
91191
python -m build --sdist
192+
92193
- uses: actions/upload-artifact@v4
93194
with:
94195
name: sdist
95196
path: ./dist/*.tar.gz
96197

97198
release:
98199
name: Release
99-
needs: [build_wheels, build_wheels_arm64, build_sdist]
200+
needs: [build_wheels, build_wheels_arm64, build_wheels_riscv64, build_sdist]
201+
if: startsWith(github.ref, 'refs/tags/')
100202
runs-on: ubuntu-latest
101203

102204
steps:

.github/workflows/build-docker.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,22 @@ permissions:
99
jobs:
1010
docker:
1111
name: Build and push Docker image
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-22.04
1313
steps:
1414
- name: Checkout
1515
uses: actions/checkout@v4
1616
with:
1717
submodules: "recursive"
1818

19+
- name: Set image tag
20+
run: |
21+
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
22+
image_tag="${GITHUB_REF_NAME}"
23+
else
24+
image_tag="${GITHUB_REF_NAME//\//-}"
25+
fi
26+
echo "IMAGE_TAG=$image_tag" >> "$GITHUB_ENV"
27+
1928
- name: Set up QEMU
2029
uses: docker/setup-qemu-action@v3
2130

@@ -40,7 +49,7 @@ jobs:
4049
platforms: linux/amd64,linux/arm64
4150
tags: |
4251
ghcr.io/abetlen/llama-cpp-python:latest
43-
ghcr.io/abetlen/llama-cpp-python:${{ github.ref_name }}
52+
ghcr.io/abetlen/llama-cpp-python:${{ env.IMAGE_TAG }}
4453
build-args: |
4554
BUILDKIT_INLINE_CACHE=1
4655

0 commit comments

Comments
 (0)