Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add benchmark test. #720

Merged
merged 49 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
9423a8a
ci: add benchmark test.
AsakusaRinne May 6, 2024
ff9e4f2
debug
AsakusaRinne May 6, 2024
5fe4814
fix runner error.
AsakusaRinne May 6, 2024
9d3eb38
change cuda11 docker image
AsakusaRinne May 6, 2024
a573932
debug
AsakusaRinne May 6, 2024
5d76857
debug
AsakusaRinne May 6, 2024
8e57b56
debug
AsakusaRinne May 6, 2024
c07c4cc
debug
AsakusaRinne May 6, 2024
413c23c
feat: add benchmark test for prefill.
AsakusaRinne May 7, 2024
1efce65
fix error.
AsakusaRinne May 7, 2024
2a1e150
Change the way to cache models.
AsakusaRinne May 7, 2024
ee55cc2
debug
AsakusaRinne May 7, 2024
d6097ac
fix error
AsakusaRinne May 7, 2024
9076d44
debug
AsakusaRinne May 7, 2024
2eae0cd
debug
AsakusaRinne May 7, 2024
1fc35ad
debug
AsakusaRinne May 7, 2024
ba7663a
debug
AsakusaRinne May 7, 2024
0a1f150
debug
AsakusaRinne May 7, 2024
ec92b64
debug
AsakusaRinne May 7, 2024
851b8fa
debug
AsakusaRinne May 7, 2024
8f3f608
debug
AsakusaRinne May 7, 2024
4f33c0d
debug
AsakusaRinne May 7, 2024
34f1f58
debug
AsakusaRinne May 8, 2024
f336a43
fix model path error.
AsakusaRinne May 8, 2024
dcb5cb6
debug
AsakusaRinne May 8, 2024
6bb5795
debug
AsakusaRinne May 8, 2024
2ddee30
debug
AsakusaRinne May 8, 2024
261a642
debug
AsakusaRinne May 8, 2024
6dfff81
debug
AsakusaRinne May 8, 2024
bfa4454
debug
AsakusaRinne May 8, 2024
7807dd7
debug
AsakusaRinne May 8, 2024
d2e2b1a
debug
AsakusaRinne May 8, 2024
4d52e8a
debug
AsakusaRinne May 8, 2024
b2d9fc0
debug
AsakusaRinne May 8, 2024
33ccc54
debug
AsakusaRinne May 8, 2024
12a9105
debug
AsakusaRinne May 8, 2024
7bdb695
debug
AsakusaRinne May 8, 2024
24f5998
debug
AsakusaRinne May 8, 2024
9758cf1
debug
AsakusaRinne May 8, 2024
0351262
debug
AsakusaRinne May 8, 2024
897e223
debug
AsakusaRinne May 8, 2024
f70af0f
debug
AsakusaRinne May 8, 2024
0112bb5
debug
AsakusaRinne May 8, 2024
12e8c59
debug
AsakusaRinne May 8, 2024
fbe4fd4
debug
AsakusaRinne May 8, 2024
194e714
debug
AsakusaRinne May 8, 2024
910c166
debug
AsakusaRinne May 8, 2024
e982de9
debug
AsakusaRinne May 8, 2024
7788746
finish the feature.
AsakusaRinne May 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/_typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ extend-exclude = [
"_typos.toml",
"docs/xmldocs/",
"LLama.Web/wwwroot/",
"LLama/runtimes/deps/"
"LLama/runtimes/deps/",
"LLama.Benchmark/Assets/",
"LLama.Examples/Assets/"
]
20 changes: 20 additions & 0 deletions .github/download_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from huggingface_hub import hf_hub_download
import argparse

if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--model-list', type=str, required=True)
parser.add_argument('--model-dir', type=str, required=True)
parser.add_argument('--endpoint', type=str, default='https://huggingface.co')
args = parser.parse_args()

with open(args.model_list, 'r') as f:
repo_id, filename = f.readline().split(',')

hf_hub_download(
repo_id=repo_id,
filename=filename,
local_dir=args.model_dir,
local_dir_use_symlinks=False,
endpoint=args.endpoint
)
74 changes: 74 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
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:
BENCHMARK_MODEL_DIR: ${{ matrix.modeldir }}
ports:
- 80
volumes:
- /llamasharp_ci:/llamasharp_ci
options: --gpus=all --ipc=host --runtime=nvidia

steps:
- uses: actions/checkout@v4

- name: Install libraries
run: |
apt update
apt install -y curl libicu-dev
apt-get install wget
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
apt-get update && apt-get install -y dotnet-sdk-8.0

- name: Prepare models
run: |
apt-get update
apt-get install -y python3.10 python3-pip
python3 --version
pip install huggingface_hub
python3 .github/download_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 clean
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 --anyCategories LLama
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: Benchmark_Results
path: BenchmarkDotNet.Artifacts/results/*
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Unit Test
on:
push:
branches: [master]
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -346,3 +346,5 @@ site/
/LLama.Unittest/Models/*.bin
/LLama.Unittest/Models/*.gguf

/LLama.Benchmark/Models/*.bin
/LLama.Benchmark/Models/*.gguf
Loading
Loading