Skip to content

Commit ec48276

Browse files
committed
Merge remote-tracking branch 'abetlen/main'
2 parents 42d26cf + f95057a commit ec48276

Some content is hidden

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

65 files changed

+6894
-2335
lines changed

.github/dependabot.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,12 @@ updates:
88
- package-ecosystem: "pip" # See documentation for possible values
99
directory: "/" # Location of package manifests
1010
schedule:
11-
interval: "weekly"
11+
interval: "daily"
12+
- package-ecosystem: "github-actions"
13+
directory: "/"
14+
schedule:
15+
interval: "daily"
16+
- package-ecosystem: "docker"
17+
directory: "/"
18+
schedule:
19+
interval: "daily"

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

+48-16
Original file line numberDiff line numberDiff line change
@@ -11,45 +11,75 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14-
os: [ubuntu-latest, windows-latest, macOS-latest]
14+
os: [ubuntu-20.04, windows-2019, macos-12]
1515

1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818
with:
1919
submodules: "recursive"
2020

2121
# Used to host cibuildwheel
22-
- uses: actions/setup-python@v3
22+
- uses: actions/setup-python@v5
2323
with:
2424
python-version: "3.8"
2525

26-
- name: Install cibuildwheel
27-
run: python -m pip install cibuildwheel==2.12.1
28-
2926
- name: Install dependencies
3027
run: |
3128
python -m pip install --upgrade pip
3229
python -m pip install -e .[all]
3330
3431
- name: Build wheels
35-
run: python -m cibuildwheel --output-dir wheelhouse
32+
uses: pypa/cibuildwheel@v2.19.2
3633
env:
3734
# disable repair
3835
CIBW_REPAIR_WHEEL_COMMAND: ""
36+
with:
37+
package-dir: .
38+
output-dir: wheelhouse
39+
40+
- uses: actions/upload-artifact@v4
41+
with:
42+
name: wheels-${{ matrix.os }}
43+
path: ./wheelhouse/*.whl
44+
45+
build_wheels_arm64:
46+
name: Build arm64 wheels
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
with:
51+
submodules: "recursive"
52+
53+
- name: Set up QEMU
54+
uses: docker/setup-qemu-action@v3
55+
with:
56+
platforms: linux/arm64
57+
58+
- name: Build wheels
59+
uses: pypa/cibuildwheel@v2.19.2
60+
env:
61+
CIBW_SKIP: "*musllinux* pp*"
62+
CIBW_REPAIR_WHEEL_COMMAND: ""
63+
CIBW_ARCHS: "aarch64"
64+
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*"
65+
with:
66+
output-dir: wheelhouse
3967

40-
- uses: actions/upload-artifact@v3
68+
- name: Upload wheels as artifacts
69+
uses: actions/upload-artifact@v4
4170
with:
71+
name: wheels_arm64
4272
path: ./wheelhouse/*.whl
4373

4474
build_sdist:
4575
name: Build source distribution
4676
runs-on: ubuntu-latest
4777

4878
steps:
49-
- uses: actions/checkout@v3
79+
- uses: actions/checkout@v4
5080
with:
5181
submodules: "recursive"
52-
- uses: actions/setup-python@v3
82+
- uses: actions/setup-python@v5
5383
with:
5484
python-version: "3.8"
5585
- name: Install dependencies
@@ -59,22 +89,24 @@ jobs:
5989
- name: Build source distribution
6090
run: |
6191
python -m build --sdist
62-
- uses: actions/upload-artifact@v3
92+
- uses: actions/upload-artifact@v4
6393
with:
94+
name: sdist
6495
path: ./dist/*.tar.gz
6596

6697
release:
6798
name: Release
68-
needs: [build_wheels, build_sdist]
99+
needs: [build_wheels, build_wheels_arm64, build_sdist]
69100
runs-on: ubuntu-latest
70101

71102
steps:
72-
- uses: actions/download-artifact@v3
103+
- uses: actions/download-artifact@v4
73104
with:
74-
name: artifact
105+
merge-multiple: true
75106
path: dist
76-
- uses: softprops/action-gh-release@v1
107+
108+
- uses: softprops/action-gh-release@v2
77109
with:
78110
files: dist/*
79111
env:
80-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build-docker.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616
with:
1717
submodules: "recursive"
1818

1919
- name: Set up QEMU
20-
uses: docker/setup-qemu-action@v2
20+
uses: docker/setup-qemu-action@v3
2121

2222
- name: Set up Docker Buildx
23-
uses: docker/setup-buildx-action@v2
23+
uses: docker/setup-buildx-action@v3
2424

2525
- name: Login to GitHub Container Registry
26-
uses: docker/login-action@v2
26+
uses: docker/login-action@v3
2727
with:
2828
registry: ghcr.io
2929
username: ${{ github.repository_owner }}
3030
password: ${{ secrets.GITHUB_TOKEN }}
3131

3232
- name: Build and push
3333
id: docker_build
34-
uses: docker/build-push-action@v4
34+
uses: docker/build-push-action@v6
3535
with:
3636
context: .
3737
file: "docker/simple/Dockerfile"
+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: Build Wheels (CUDA)
2+
3+
on: workflow_dispatch
4+
5+
permissions:
6+
contents: write
7+
8+
jobs:
9+
define_matrix:
10+
name: Define Build Matrix
11+
runs-on: ubuntu-latest
12+
outputs:
13+
matrix: ${{ steps.set-matrix.outputs.matrix }}
14+
defaults:
15+
run:
16+
shell: pwsh
17+
18+
steps:
19+
- name: Define Job Output
20+
id: set-matrix
21+
run: |
22+
$matrix = @{
23+
'os' = @('ubuntu-latest', 'windows-2019')
24+
'pyver' = @("3.9", "3.10", "3.11", "3.12")
25+
'cuda' = @("12.1.1", "12.2.2", "12.3.2", "12.4.1")
26+
'releasetag' = @("basic")
27+
}
28+
29+
$matrixOut = ConvertTo-Json $matrix -Compress
30+
Write-Output ('matrix=' + $matrixOut) >> $env:GITHUB_OUTPUT
31+
32+
build_wheels:
33+
name: Build Wheel ${{ matrix.os }} ${{ matrix.pyver }} ${{ matrix.cuda }} ${{ matrix.releasetag == 'wheels' && 'AVX2' || matrix.releasetag }}
34+
needs: define_matrix
35+
runs-on: ${{ matrix.os }}
36+
strategy:
37+
matrix: ${{ fromJSON(needs.define_matrix.outputs.matrix) }}
38+
defaults:
39+
run:
40+
shell: pwsh
41+
env:
42+
CUDAVER: ${{ matrix.cuda }}
43+
AVXVER: ${{ matrix.releasetag }}
44+
45+
steps:
46+
- name: Add MSBuild to PATH
47+
if: runner.os == 'Windows'
48+
uses: microsoft/setup-msbuild@v2
49+
with:
50+
vs-version: '[16.11,16.12)'
51+
52+
- uses: actions/checkout@v4
53+
with:
54+
submodules: "recursive"
55+
56+
- uses: actions/setup-python@v5
57+
with:
58+
python-version: ${{ matrix.pyver }}
59+
cache: 'pip'
60+
61+
- name: Setup Mamba
62+
uses: conda-incubator/setup-miniconda@v3.0.4
63+
with:
64+
activate-environment: "build"
65+
python-version: ${{ matrix.pyver }}
66+
miniforge-variant: Mambaforge
67+
miniforge-version: latest
68+
use-mamba: true
69+
add-pip-as-python-dependency: true
70+
auto-activate-base: false
71+
72+
- name: VS Integration Cache
73+
id: vs-integration-cache
74+
if: runner.os == 'Windows'
75+
uses: actions/cache@v4.0.2
76+
with:
77+
path: ./MSBuildExtensions
78+
key: cuda-${{ matrix.cuda }}-vs-integration
79+
80+
- name: Get Visual Studio Integration
81+
if: runner.os == 'Windows' && steps.vs-integration-cache.outputs.cache-hit != 'true'
82+
run: |
83+
if ($env:CUDAVER -eq '12.1.1') {$x = '12.1.0'} else {$x = $env:CUDAVER}
84+
$links = (Invoke-RestMethod 'https://raw.githubusercontent.com/Jimver/cuda-toolkit/master/src/links/windows-links.ts').Trim().split().where({$_ -ne ''})
85+
for ($i=$q=0;$i -lt $links.count -and $q -lt 2;$i++) {if ($links[$i] -eq "'$x',") {$q++}}
86+
Invoke-RestMethod $links[$i].Trim("'") -OutFile 'cudainstaller.zip'
87+
& 'C:\Program Files\7-Zip\7z.exe' e cudainstaller.zip -oMSBuildExtensions -r *\MSBuildExtensions\* > $null
88+
Remove-Item 'cudainstaller.zip'
89+
90+
- name: Install Visual Studio Integration
91+
if: runner.os == 'Windows'
92+
run: |
93+
$y = (gi '.\MSBuildExtensions').fullname + '\*'
94+
(gi 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\*\BuildCustomizations').fullname.foreach({cp $y $_})
95+
$cupath = 'CUDA_PATH_V' + $env:CUDAVER.Remove($env:CUDAVER.LastIndexOf('.')).Replace('.','_')
96+
echo "$cupath=$env:CONDA_PREFIX" >> $env:GITHUB_ENV
97+
98+
- name: Install Dependencies
99+
env:
100+
MAMBA_DOWNLOAD_FAILFAST: "0"
101+
MAMBA_NO_LOW_SPEED_LIMIT: "1"
102+
run: |
103+
$cudaVersion = $env:CUDAVER
104+
mamba install -y 'cuda' -c nvidia/label/cuda-$cudaVersion
105+
python -m pip install build wheel
106+
107+
- name: Build Wheel
108+
run: |
109+
$cudaVersion = $env:CUDAVER.Remove($env:CUDAVER.LastIndexOf('.')).Replace('.','')
110+
$env:CUDA_PATH = $env:CONDA_PREFIX
111+
$env:CUDA_HOME = $env:CONDA_PREFIX
112+
$env:CUDA_TOOLKIT_ROOT_DIR = $env:CONDA_PREFIX
113+
if ($IsLinux) {
114+
$env:LD_LIBRARY_PATH = $env:CONDA_PREFIX + '/lib:' + $env:LD_LIBRARY_PATH
115+
}
116+
$env:VERBOSE = '1'
117+
$env:CMAKE_ARGS = '-DGGML_CUDA=on -DCMAKE_CUDA_ARCHITECTURES=all'
118+
$env:CMAKE_ARGS = "-DGGML_CUDA_FORCE_MMQ=ON $env:CMAKE_ARGS"
119+
# if ($env:AVXVER -eq 'AVX') {
120+
$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DGGML_AVX2=off -DGGML_FMA=off -DGGML_F16C=off'
121+
# }
122+
# if ($env:AVXVER -eq 'AVX512') {
123+
# $env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DGGML_AVX512=on'
124+
# }
125+
# if ($env:AVXVER -eq 'basic') {
126+
# $env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DGGML_AVX=off -DGGML_AVX2=off -DGGML_FMA=off -DGGML_F16C=off'
127+
# }
128+
python -m build --wheel
129+
# write the build tag to the output
130+
Write-Output "CUDA_VERSION=$cudaVersion" >> $env:GITHUB_ENV
131+
132+
- uses: softprops/action-gh-release@v2
133+
with:
134+
files: dist/*
135+
# Set tag_name to <tag>-cu<cuda_version>
136+
tag_name: ${{ github.ref_name }}-cu${{ env.CUDA_VERSION }}
137+
env:
138+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build Wheels (Metal)
2+
3+
on: workflow_dispatch
4+
5+
permissions:
6+
contents: write
7+
8+
jobs:
9+
build_wheels:
10+
name: Build wheels on ${{ matrix.os }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [macos-12, macos-13, macos-14]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
submodules: "recursive"
20+
21+
# Used to host cibuildwheel
22+
- uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.12"
25+
cache: 'pip'
26+
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
python -m pip install -e .[all]
31+
32+
- name: Build wheels
33+
uses: pypa/cibuildwheel@v2.19.2
34+
env:
35+
# disable repair
36+
CIBW_REPAIR_WHEEL_COMMAND: ""
37+
CIBW_ARCHS: "arm64"
38+
CIBW_ENVIRONMENT: CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_APPLE_SILICON_PROCESSOR=arm64 -DGGML_METAL=on"
39+
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*"
40+
with:
41+
package-dir: .
42+
output-dir: wheelhouse2
43+
44+
- uses: actions/upload-artifact@v4
45+
with:
46+
name: wheels-mac_${{ matrix.os }}
47+
path: ./wheelhouse2/*.whl
48+
49+
release:
50+
name: Release
51+
needs: [build_wheels]
52+
runs-on: ubuntu-latest
53+
54+
steps:
55+
- uses: actions/download-artifact@v4
56+
with:
57+
merge-multiple: true
58+
path: dist2
59+
60+
- uses: softprops/action-gh-release@v2
61+
with:
62+
files: dist2/*
63+
# set release name to <tag>-metal
64+
tag_name: ${{ github.ref_name }}-metal
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)