ci: add benchmark test. #15
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Benchmark Test | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-benchmark | |
cancel-in-progress: true | |
jobs: | |
linux-benchmark-cuda: | |
if: contains(github.event.pull_request.labels.*.name, 'benchmark') | |
runs-on: [self-hosted, linux, gpu] | |
strategy: | |
fail-fast: false | |
matrix: | |
build: [cuda11] | |
include: | |
- build: cuda11 | |
image: nvidia/cuda:11.7.1-devel-ubuntu22.04 | |
modeldir: /llamasharp_ci/models_benchmark | |
# - build: cuda12 | |
# image: nvidia/cuda:12.1.1-runtime-ubuntu22.04 | |
container: | |
image: ${{ matrix.image }} | |
env: | |
NODE_ENV: development | |
ports: | |
- 80 | |
volumes: | |
- /llamasharp_ci:/llamasharp_ci | |
options: --gpus=all --ipc=host --runtime=nvidia | |
steps: | |
- name: DEBUG | |
run: | | |
whoami | |
nvidia-smi | |
nvcc -V | |
- name: Install libraries | |
run: | | |
apt update | |
apt install -y curl libicu-dev | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
8.0.x | |
- name: Prepare models | |
run: | | |
apt-get install -y python3.10 | |
pip install huggingface_hub | |
python3 LLama.Benchmark/prepare_models.py --model-dir ${{ matrix.modeldir }} --model-list LLama.Benchmark/Assets/models.txt --endpoint https://hf-mirror.com | |
- name: Clear package cache | |
run: dotnet clean LLamaSharp.sln && dotnet nuget locals all --clear | |
- name: Restore packages | |
run: dotnet restore LLamaSharp.sln | |
- name: Build | |
run: | | |
dotnet build LLama/LLamaSharp.csproj -c release --no-restore | |
dotnet build LLama.Benchmark/LLama.Benchmark.csproj -c release --no-restore | |
- name: Run benchmark test | |
run: dotnet run --project LLama.Benchmark/LLama.Benchmark.csproj -c release ${{ matrix.modeldir }} | |
- name: Upload artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Benchmark_Results | |
path: BenchmarkDotNet.Artifacts/results/* |