char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
acecd5603
char/aliceai-t5-moe
1name : CI (cpu) 2 3on : 4workflow_dispatch : # allows manual triggering 5push : 6branches : 7- master 8paths : [ 9'.github/workflows/build-cpu.yml' , 10'.github/workflows/build-cmake-pkg.yml' , 11'**/CMakeLists.txt' , 12'**/.cmake' , 13'**/*.h' , 14'**/*.hpp' , 15'**/*.c' , 16'**/*.cpp' , 17] 18 19pull_request : 20types : [ opened , synchronize , reopened ] 21paths : [ 22'.github/workflows/build-cpu.yml' , 23'.github/workflows/build-cmake-pkg.yml' , 24'ggml/src/ggml-rpc/**' , 25'**/CMakeLists.txt' , 26'**/.cmake' , 27'**/*.h' , 28'**/*.hpp' , 29'**/*.c' , 30'**/*.cpp' 31] 32 33concurrency : 34group : ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} 35cancel-in-progress : true 36 37env : 38GGML_NLOOP : 3 39GGML_N_THREADS : 1 40LLAMA_ARG_LOG_COLORS : 1 41LLAMA_ARG_LOG_PREFIX : 1 42LLAMA_ARG_LOG_TIMESTAMPS : 1 43 44jobs : 45build-cmake-pkg : 46uses : ./.github/workflows/build-cmake-pkg.yml 47 48ubuntu : 49strategy : 50matrix : 51include : 52- build : 'x64' 53os : ubuntu-22.04 54- build : 'arm64' 55os : ubuntu-24.04-arm 56 57runs-on : ${{ matrix.os }} 58 59steps : 60- name : Clone 61id : checkout 62uses : actions/checkout@v6 63 64- name : ccache 65uses : ggml-org/ccache-action@v1.2.24 66with : 67key : cpu-${{ matrix.os }} 68save : false 69 70- name : Build Dependencies 71id : build_depends 72run : | 73sudo apt-get update 74sudo apt-get install -y --no-install-recommends \ 75python3 python3-pip python3-dev python3-wheel \ 76libjpeg-dev build-essential libssl-dev \ 77git-lfs 78 79- name : Toolchain workaround (GCC 14) 80if : ${{ contains(matrix.os, 'ubuntu-24.04') }} 81run : | 82sudo apt-get install -y gcc-14 g++-14 83echo "CC=gcc-14" >> "$GITHUB_ENV" 84echo "CXX=g++-14" >> "$GITHUB_ENV" 85 86- name : Python Dependencies 87id : python_depends 88run : | 89export PIP_BREAK_SYSTEM_PACKAGES="1" 90python3 -m pip install --upgrade pip setuptools 91pip3 install ./gguf-py 92 93- name : ccache-buckets-restore 94uses : ./.github/actions/ccache-buckets 95env : 96HF_TOKEN : ${{ secrets.HF_TOKEN_CI }} 97with : 98key : cpu-${{ matrix.os }} 99folder : llama.cpp 100hf_bucket : ggml-org/cache 101 102- name : Build 103id : cmake_build 104run : | 105cmake -B build \ 106-DGGML_NATIVE=OFF \ 107-DLLAMA_FATAL_WARNINGS=ON \ 108-DGGML_RPC=ON 109time cmake --build build --config Release -j $(nproc) 110 111- name : ccache-buckets-save 112if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} 113uses : ./.github/actions/ccache-buckets 114env : 115HF_TOKEN : ${{ secrets.HF_TOKEN_CACHE_OUTPUT }} 116with : 117key : cpu-${{ matrix.os }} 118folder : llama.cpp 119evict-old-files : 1d 120hf_bucket : ggml-org/cache 121save : true 122 123- name : Test 124id : cmake_test 125run : | 126cd build 127ctest -L main --verbose --timeout 900 128 129- name : Test llama2c conversion 130id : llama2c_test 131run : | 132cd build 133echo "Fetch tokenizer" 134wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin 135echo "Fetch llama2c model" 136wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin 137./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf 138./bin/llama-completion -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256 139 140windows : 141name : windows / ${{ matrix.build }} 142runs-on : windows-2025 143 144env : 145OPENBLAS_VERSION : 0.3.23 146SDE_VERSION : 9.33.0-2024-01-07 147 148strategy : 149matrix : 150include : 151- build : 'x64-cpu-static' 152arch : 'x64' 153defines : '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/x64-windows-llvm.cmake -DGGML_NATIVE=OFF -DGGML_OPENMP_FETCH=ON -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DBUILD_SHARED_LIBS=OFF' 154- build : 'x64-openblas' 155arch : 'x64' 156defines : '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/x64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DGGML_OPENMP=OFF -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS -DBLAS_INCLUDE_DIRS="$env:RUNNER_TEMP/openblas/include" -DBLAS_LIBRARIES="$env:RUNNER_TEMP/openblas/lib/openblas.lib"' 157- build : 'arm64' 158arch : 'arm64' 159defines : '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DGGML_NATIVE=OFF -DGGML_OPENMP_FETCH=ON -DLLAMA_BUILD_SERVER=ON' 160 161steps : 162- name : Clone 163id : checkout 164uses : actions/checkout@v6 165 166- name : ccache 167uses : ggml-org/ccache-action@v1.2.24 168with : 169key : cpu-windows-2025-${{ matrix.build }} 170variant : ccache 171evict-old-files : 1d 172save : ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} 173 174- name : Download OpenBLAS 175id : get_openblas 176if : ${{ matrix.build == 'x64-openblas' }} 177run : | 178curl.exe -o $env:RUNNER_TEMP/openblas.zip -L "https://github.com/xianyi/OpenBLAS/releases/download/v${env:OPENBLAS_VERSION}/OpenBLAS-${env:OPENBLAS_VERSION}-x64.zip" 179curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE" 180mkdir $env:RUNNER_TEMP/openblas 181tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas 182$vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath) 183$msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim())) 184$lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe') 185& $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll 186 187- name : Install Ninja 188id : install_ninja 189run : | 190choco install ninja 191 192- name : Build 193id : cmake_build 194run : | 195cmake -S . -B build ${{ matrix.defines }} ` 196-DLLAMA_BUILD_BORINGSSL=ON 197cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS} 198 199- name : Add libopenblas.dll 200id : add_libopenblas_dll 201if : ${{ matrix.build == 'x64-openblas' }} 202run : | 203cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll 204cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt 205 206- name : Test 207id : cmake_test 208if : ${{ matrix.arch == 'x64' }} 209run : | 210cd build 211ctest -L main -C Release --verbose --timeout 900 212 213# TODO: disabled for now, consider adding tests for all CPU variants instead 214# - name: Test (Intel SDE) 215# id: cmake_test_sde 216# if: ${{ matrix.build == 'avx512-x64' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation 217# run: | 218# curl.exe -o $env:RUNNER_TEMP/sde.tar.xz -L "https://downloadmirror.intel.com/813591/sde-external-${env:SDE_VERSION}-win.tar.xz" 219# # for some weird reason windows tar doesn't like sde tar.xz 220# 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar.xz 221# 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar 222# $sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe) 223# cd build 224# & $sde -future -- ctest -L main -C Release --verbose --timeout 900 225 226- name : ccache-clear 227uses : ./.github/actions/ccache-clear 228env : 229GH_TOKEN : ${{ github.token }} 230with : 231key : cpu-windows-2025-${{ matrix.build }} 232older : 5m 233min : 1 234dry-run : ${{ github.event_name != 'push' || github.ref != 'refs/heads/master' }}