Skip to content

Commit 218754a

Browse files
authored
Merge pull request #164 from scottmonster/fix-162
Fix 162
2 parents d08a075 + cba74b9 commit 218754a

4 files changed

Lines changed: 45 additions & 16 deletions

File tree

.github/workflows/pip.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,22 @@ jobs:
1414
matrix:
1515
platform: [windows-latest, macos-14, ubuntu-latest]
1616
python-version: ["3.8", "3.11"]
17+
include:
18+
- platform: windows-latest
19+
cmake_args: -DGGML_BMI2=OFF
20+
- platform: macos-14
21+
cmake_args: >-
22+
-DGGML_NATIVE=OFF
23+
-DGGML_CPU_ARM_ARCH=armv8-a
1724
1825
runs-on: ${{ matrix.platform }}
1926

2027
steps:
21-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v6
2229
with:
2330
submodules: true
2431

25-
- uses: actions/setup-python@v5
32+
- uses: actions/setup-python@v6
2633
with:
2734
python-version: ${{ matrix.python-version }}
2835

@@ -33,6 +40,9 @@ jobs:
3340
run: python -m pip install -r requirements.txt
3441

3542
- name: Build and install
43+
env:
44+
CMAKE_ARGS: ${{ matrix.cmake_args }}
45+
ARCHFLAGS: ${{ matrix.archflags }}
3646
run: pip install --verbose .[test]
3747

3848
# - name: Test C-API

.github/workflows/wheels.yml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
name: Build SDist
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v6
1919
with:
2020
submodules: true
2121

@@ -25,7 +25,7 @@ jobs:
2525
- name: Check metadata
2626
run: pipx run twine check dist/*
2727

28-
- uses: actions/upload-artifact@v4
28+
- uses: actions/upload-artifact@v7
2929
with:
3030
name: artifact-sdist
3131
path: dist/*.tar.gz
@@ -37,15 +37,27 @@ jobs:
3737
strategy:
3838
fail-fast: false
3939
matrix:
40-
os: [ubuntu-24.04-arm, ubuntu-latest, windows-2022, macos-14]
40+
include:
41+
- os: ubuntu-24.04-arm
42+
cmake_args: "-DGGML_NATIVE=OFF -DGGML_CPU_ARM_ARCH=armv8-a"
43+
- os: ubuntu-latest
44+
cmake_args: "-DGGML_NATIVE=OFF"
45+
- os: windows-2022
46+
# Whisper.cpp tries to use BMI2 on 32 bit Windows, so disable BMI2 when building on Windows to avoid that bug. See https://github.com/ggml-org/whisper.cpp/pull/3543
47+
# If Windows still crashes after this, the next step would be disabling GGML_AVX, GGML_AVX2, GGML_FMA, and GGML_F16C with:
48+
# -DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF -DGGML_F16C=OFF
49+
# NOTE: these may also help the ubuntu-latest builds as well
50+
cmake_args: "-DGGML_NATIVE=OFF -DGGML_BMI2=OFF -DGGML_AVX512=OFF -DGGML_AVX512_VBMI=OFF -DGGML_AVX512_VNNI=OFF -DGGML_AVX512_BF16=OFF"
51+
- os: macos-14
52+
cmake_args: "-DGGML_NATIVE=OFF"
4153

4254
steps:
43-
- uses: actions/checkout@v4
55+
- uses: actions/checkout@v6
4456
with:
4557
submodules: true
4658

4759
# Used to host cibuildwheel
48-
- uses: actions/setup-python@v5
60+
- uses: actions/setup-python@v6
4961

5062
- name: Install cibuildwheel
5163
run: python -m pip install cibuildwheel
@@ -56,8 +68,7 @@ jobs:
5668
CIBW_ARCHS: auto
5769
# for windows setup.py repairwheel step should solve it
5870
CIBW_SKIP: pp* cp38-*
59-
# Whisper.cpp tries to use BMI2 on 32 bit Windows, so disable BMI2 when building on Windows to avoid that bug. See https://github.com/ggml-org/whisper.cpp/pull/3543
60-
CIBW_ENVIRONMENT: CMAKE_ARGS="${{ contains(matrix.os, 'arm') && '-DGGML_NATIVE=OFF -DGGML_CPU_ARM_ARCH=armv8-a' || ''}} ${{ contains(matrix.os, 'windows') && '-DGGML_BMI2=OFF' || '' }}"
71+
CIBW_ENVIRONMENT: CMAKE_ARGS="${{ matrix.cmake_args }}"
6172

6273
- name: Verify clean directory
6374
run: git diff --exit-code
@@ -67,7 +78,7 @@ jobs:
6778
run: ls wheelhouse
6879

6980
- name: Upload wheels
70-
uses: actions/upload-artifact@v4
81+
uses: actions/upload-artifact@v7
7182
with:
7283
name: artifact-${{ matrix.os }}
7384
path: wheelhouse/*.whl
@@ -83,11 +94,11 @@ jobs:
8394
python-version: [3.11, 3.12, 3.13]
8495

8596
steps:
86-
- uses: actions/checkout@v4
97+
- uses: actions/checkout@v6
8798
with:
8899
submodules: true
89100

90-
- uses: actions/download-artifact@v4
101+
- uses: actions/download-artifact@v8
91102
with:
92103
pattern: artifact-*
93104
merge-multiple: true
@@ -98,7 +109,7 @@ jobs:
98109
ls -l wheelhouse
99110
100111
- name: Set up Python
101-
uses: actions/setup-python@v5
112+
uses: actions/setup-python@v6
102113
with:
103114
python-version: ${{ matrix.python-version }}
104115

@@ -123,11 +134,11 @@ jobs:
123134
if: github.event_name == 'release' && github.event.action == 'published'
124135

125136
steps:
126-
- uses: actions/setup-python@v5
137+
- uses: actions/setup-python@v6
127138
with:
128139
python-version: "3.x"
129140

130-
- uses: actions/download-artifact@v4
141+
- uses: actions/download-artifact@v8
131142
with:
132143
pattern: artifact-*
133144
merge-multiple: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _generate/
88
*.egg-info
99
*env*
1010

11+
logs_*
1112

1213
# custom
1314
.idea

setup.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def build_extension(self, ext: CMakeExtension) -> None:
7777
"-DCMAKE_INSTALL_RPATH=@loader_path",
7878
"-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON"
7979
]
80+
8081
elif sys.platform.startswith('linux'):
8182
# Linux-specific settings
8283
cmake_args += [
@@ -132,6 +133,11 @@ def build_extension(self, ext: CMakeExtension) -> None:
132133
build_args += ["--config", cfg]
133134

134135
if sys.platform.startswith("darwin"):
136+
137+
os.environ.setdefault("MACOSX_DEPLOYMENT_TARGET", "14.0")
138+
cmake_args += [
139+
f"-DCMAKE_OSX_DEPLOYMENT_TARGET={os.environ['MACOSX_DEPLOYMENT_TARGET']}"
140+
]
135141
# Cross-compile support for macOS - respect ARCHFLAGS if set
136142
archs = re.findall(r"-arch (\S+)", os.environ.get("ARCHFLAGS", ""))
137143
if archs:
@@ -191,7 +197,8 @@ def run(self):
191197
if os.environ.get('NO_REPAIR', '0') == '1':
192198
print("Skipping wheel repair")
193199
return
194-
if os.environ.get('CIBUILDWHEEL', '0') == '0' or sys.platform.startswith('win'):
200+
# if os.environ.get('CIBUILDWHEEL', '0') == '0' or sys.platform.startswith('win'):
201+
if sys.platform.startswith('win'):
195202
# for linux and macos we use the default wheel repair command from cibuildwheel, for windows we need to do it manually as there is no repair command
196203
self.repair_wheel()
197204

0 commit comments

Comments
 (0)