1
+ name : Build Wheels 0.1.76
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ workflow_call :
6
+
7
+ permissions :
8
+ contents : write
9
+
10
+ jobs :
11
+ build_wheels :
12
+ name : ${{ matrix.os }} ${{ matrix.pyver }} ${{ matrix.cuda }} ${{ matrix.releasetag == 'wheels' && 'AVX2' || matrix.releasetag }}
13
+ runs-on : ${{ matrix.os }}
14
+ strategy :
15
+ matrix :
16
+ os : [ubuntu-20.04, windows-latest]
17
+ pyver : ["3.7", "3.8", "3.9", "3.10", "3.11"]
18
+ cuda : ["11.6.2", "11.7.1", "11.8.0", "12.0.1", "12.1.1", "12.2.0"]
19
+ releasetag : ["AVX","wheels","AVX512"]
20
+ defaults :
21
+ run :
22
+ shell : pwsh
23
+ env :
24
+ CUDAVER : ${{ matrix.cuda }}
25
+ AVXVER : ${{ matrix.releasetag }}
26
+
27
+ steps :
28
+ - uses : actions/checkout@v3
29
+ with :
30
+ repository : ' abetlen/llama-cpp-python'
31
+ ref : v0.1.76
32
+ submodules : ' recursive'
33
+
34
+ - uses : actions/setup-python@v3
35
+ with :
36
+ python-version : ${{ matrix.pyver }}
37
+
38
+ - name : Setup Mamba
39
+ uses : conda-incubator/setup-miniconda@v2.2.0
40
+ with :
41
+ activate-environment : " build"
42
+ python-version : ${{ matrix.pyver }}
43
+ miniforge-variant : Mambaforge
44
+ miniforge-version : latest
45
+ use-mamba : true
46
+ add-pip-as-python-dependency : true
47
+ auto-activate-base : false
48
+
49
+ - name : Install Dependencies
50
+ run : |
51
+ $cudaVersion = $env:CUDAVER
52
+ $cudaChannels = ''
53
+ $cudaNum = [int]$cudaVersion.substring($cudaVersion.LastIndexOf('.')+1)
54
+ while ($cudaNum -ge 0) { $cudaChannels += '-c nvidia/label/cuda-' + $cudaVersion.Remove($cudaVersion.LastIndexOf('.')+1) + $cudaNum + ' '; $cudaNum-- }
55
+ mamba install -y 'cuda' $cudaChannels.TrimEnd().Split()
56
+ python -m pip install build wheel
57
+
58
+ - name : Build Wheel
59
+ run : |
60
+ $cudaVersion = $env:CUDAVER.Remove($env:CUDAVER.LastIndexOf('.')).Replace('.','')
61
+ $env:CUDA_PATH = $env:CONDA_PREFIX
62
+ $env:CUDA_HOME = $env:CONDA_PREFIX
63
+ if ($IsLinux) {$env:LD_LIBRARY_PATH = $env:CONDA_PREFIX + '/lib:' + $env:LD_LIBRARY_PATH}
64
+ $env:VERBOSE = '1'
65
+ $env:FORCE_CMAKE = '1'
66
+ $env:CMAKE_ARGS = '-DLLAMA_CUBLAS=on -DCMAKE_CUDA_ARCHITECTURES=all'
67
+ if ($env:AVXVER -eq 'AVX') {$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DLLAMA_AVX2=off'}
68
+ if ($env:AVXVER -eq 'AVX512') {$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DLLAMA_AVX512=on'}
69
+ python -m build --wheel -C--build-option=egg_info "-C--build-option=--tag-build=+cu$cudaVersion"
70
+
71
+ - name : Upload files to a GitHub release
72
+ id : upload-release
73
+ uses : svenstaro/upload-release-action@2.6.1
74
+ continue-on-error : true
75
+ with :
76
+ file : ./dist/*.whl
77
+ tag : ${{ matrix.releasetag }}
78
+ file_glob : true
79
+ make_latest : false
80
+ overwrite : true
81
+
82
+ - uses : actions/upload-artifact@v3
83
+ if : steps.upload-release.outcome == 'failure'
84
+ with :
85
+ name : ${{ matrix.releasetag == 'wheels' && 'AVX2' || matrix.releasetag }}
86
+ path : ./dist/*.whl
0 commit comments