Felipe97/llama-cpp-compiled
01.2k
1name: CI (riscv)2 3on:4 workflow_dispatch: # allows manual triggering5 push:6 branches:7 - master8 paths: [9 '.github/workflows/build-riscv.yml',10 '**/CMakeLists.txt',11 '**/.cmake',12 '**/*.h',13 '**/*.hpp',14 '**/*.c',15 '**/*.cpp'16 ]17 18 pull_request:19 types: [opened, synchronize, reopened]20 paths: [21 '.github/workflows/build-riscv.yml',22 'ggml/src/ggml-cpu/arch/riscv/**'23 ]24 25concurrency:26 group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}27 cancel-in-progress: true28 29env:30 GGML_NLOOP: 331 GGML_N_THREADS: 132 LLAMA_ARG_LOG_COLORS: 133 LLAMA_ARG_LOG_PREFIX: 134 LLAMA_ARG_LOG_TIMESTAMPS: 135 36jobs:37 ubuntu-cpu-riscv64-native:38 runs-on: ubuntu-24.04-riscv39 40 steps:41 - name: Install dependencies42 run: |43 # Install necessary packages44 sudo apt-get update45 sudo apt-get install -y libssl-dev46 47 # Set gcc-14 and g++-14 as the default compilers48 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 10049 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 10050 51 git lfs install52 53 - name: Check environment54 run: |55 uname -a56 gcc --version57 g++ --version58 ldd --version59 cmake --version60 rustc --version61 env62 echo "nproc=$(nproc)"63 64 - name: Clone65 id: checkout66 uses: actions/checkout@v667 68 # note: sparing some ccache since these jobs run on dedicated runners that are not part of the organitzation69 #- name: ccache70 # uses: ggml-org/ccache-action@v1.2.2471 # with:72 # key: riscv-ubuntu-native73 # evict-old-files: 1d74 # save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}75 76 - name: Build77 id: cmake_build78 run: |79 cmake -B build \80 -DCMAKE_BUILD_TYPE=Release \81 -DGGML_OPENMP=OFF \82 -DLLAMA_BUILD_EXAMPLES=ON \83 -DLLAMA_BUILD_TOOLS=ON \84 -DLLAMA_BUILD_TESTS=ON \85 -DCMAKE_C_COMPILER_LAUNCHER=ccache \86 -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \87 -DGGML_RPC=ON \88 -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \89 -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-1490 91 time cmake --build build --config Release -j $(nproc)92 93 - name: Test94 id: cmake_test95 run: |96 cd build97 ctest -L main --verbose --timeout 90098 99 - name: Test llama2c conversion100 id: llama2c_test101 run: |102 cd build103 echo "Fetch tokenizer"104 wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin105 echo "Fetch llama2c model"106 wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin107 ./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf108 ./bin/llama-completion -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256109 