Team Ai
Modelpublic

Felipe97/llama-cpp-compiled

sourceHugging Faceupdated 21d agoView on Hugging Face
0likes1.2kdownloads
build-cpu.yml235 linesDownload Raw Back to workflows
1name: CI (cpu)2 3on:4  workflow_dispatch: # allows manual triggering5  push:6    branches:7      - master8    paths: [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 19  pull_request:20    types: [opened, synchronize, reopened]21    paths: [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:34  group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}35  cancel-in-progress: true36 37env:38  GGML_NLOOP: 339  GGML_N_THREADS: 140  LLAMA_ARG_LOG_COLORS: 141  LLAMA_ARG_LOG_PREFIX: 142  LLAMA_ARG_LOG_TIMESTAMPS: 143 44jobs:45  build-cmake-pkg:46    uses: ./.github/workflows/build-cmake-pkg.yml47 48  ubuntu:49    strategy:50      matrix:51        include:52          - build: 'x64'53            os: ubuntu-22.0454          - build: 'arm64'55            os: ubuntu-24.04-arm56 57    runs-on: ${{ matrix.os }}58 59    steps:60      - name: Clone61        id: checkout62        uses: actions/checkout@v663 64      - name: ccache65        uses: ggml-org/ccache-action@v1.2.2466        with:67          key: cpu-${{ matrix.os }}68          save: false69 70      - name: Build Dependencies71        id: build_depends72        run: |73          sudo apt-get update74          sudo apt-get install -y --no-install-recommends \75            python3 python3-pip python3-dev python3-wheel \76            libjpeg-dev build-essential libssl-dev \77            git-lfs78 79      - name: Toolchain workaround (GCC 14)80        if: ${{ contains(matrix.os, 'ubuntu-24.04') }}81        run: |82          sudo apt-get install -y gcc-14 g++-1483          echo "CC=gcc-14" >> "$GITHUB_ENV"84          echo "CXX=g++-14" >> "$GITHUB_ENV"85 86      - name: Python Dependencies87        id: python_depends88        run: |89          export PIP_BREAK_SYSTEM_PACKAGES="1"90          python3 -m pip install --upgrade pip setuptools91          pip3 install ./gguf-py92 93      - name: ccache-buckets-restore94        uses: ./.github/actions/ccache-buckets95        env:96          HF_TOKEN: ${{ secrets.HF_TOKEN_CI }}97        with:98          key: cpu-${{ matrix.os }}99          folder: llama.cpp100          hf_bucket: ggml-org/cache101 102      - name: Build103        id: cmake_build104        run: |105          cmake -B build \106            -DGGML_NATIVE=OFF \107            -DLLAMA_FATAL_WARNINGS=ON \108            -DGGML_RPC=ON109          time cmake --build build --config Release -j $(nproc)110 111      - name: ccache-buckets-save112        if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}113        uses: ./.github/actions/ccache-buckets114        env:115          HF_TOKEN: ${{ secrets.HF_TOKEN_CACHE_OUTPUT }}116        with:117          key: cpu-${{ matrix.os }}118          folder: llama.cpp119          evict-old-files: 1d120          hf_bucket: ggml-org/cache121          save: true122 123      - name: Test124        id: cmake_test125        run: |126          cd build127          ctest -L main --verbose --timeout 900128 129      - name: Test llama2c conversion130        id: llama2c_test131        run: |132          cd build133          echo "Fetch tokenizer"134          wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin135          echo "Fetch llama2c model"136          wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin137          ./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf138          ./bin/llama-completion -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256139 140  windows:141    name: windows / ${{ matrix.build }}142    runs-on: windows-2025143 144    env:145      OPENBLAS_VERSION: 0.3.23146      SDE_VERSION: 9.33.0-2024-01-07147 148    strategy:149      matrix:150        include:151          - build: 'x64-cpu-static'152            arch: 'x64'153            defines: '-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'155            arch: 'x64'156            defines: '-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'158            arch: 'arm64'159            defines: '-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 161    steps:162      - name: Clone163        id: checkout164        uses: actions/checkout@v6165 166      - name: ccache167        uses: ggml-org/ccache-action@v1.2.24168        with:169          key: cpu-windows-2025-${{ matrix.build }}170          variant: ccache171          evict-old-files: 1d172          save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}173 174      - name: Download OpenBLAS175        id: get_openblas176        if: ${{ matrix.build == 'x64-openblas' }}177        run: |178          curl.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"179          curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE"180          mkdir $env:RUNNER_TEMP/openblas181          tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas182          $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.dll186 187      - name: Install Ninja188        id: install_ninja189        run: |190          choco install ninja191 192      - name: Build193        id: cmake_build194        run: |195          cmake -S . -B build ${{ matrix.defines }} `196            -DLLAMA_BUILD_BORINGSSL=ON197          cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}198 199      - name: Add libopenblas.dll200        id: add_libopenblas_dll201        if: ${{ matrix.build == 'x64-openblas' }}202        run: |203          cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll204          cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt205 206      - name: Test207        id: cmake_test208        if: ${{ matrix.arch == 'x64' }}209        run: |210          cd build211          ctest -L main -C Release --verbose --timeout 900212 213      # TODO: disabled for now, consider adding tests for all CPU variants instead214      # - name: Test (Intel SDE)215      #   id: cmake_test_sde216      #   if: ${{ matrix.build == 'avx512-x64' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation217      #   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.xz220      #     7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar.xz221      #     7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar222      #     $sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe)223      #     cd build224      #     & $sde -future -- ctest -L main -C Release --verbose --timeout 900225 226      - name: ccache-clear227        uses: ./.github/actions/ccache-clear228        env:229          GH_TOKEN: ${{ github.token }}230        with:231          key: cpu-windows-2025-${{ matrix.build }}232          older: 5m233          min: 1234          dry-run: ${{ github.event_name != 'push' || github.ref != 'refs/heads/master' }}235