forked from opea-project/GenAIExamples
-
Notifications
You must be signed in to change notification settings - Fork 2
78 lines (69 loc) · 3.17 KB
/
chatqna_benchmark.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: benchmark test with chatqna_benchmark
on:
# pull_request:
# branches: [main]
# types: [opened, reopened, ready_for_review, synchronize]
# # inputs:
# # variables:
# # hardware:
# # description: 'Enter your param' #gaudi or xeon
# # required: true
# # default: xeon
schedule:
- cron: "35 0 * * 6"
workflow_dispatch:
inputs:
hardware:
description: 'Enter your hardware' #gaudi or xeon
required: true
default: gaudi
jobs:
Example-test:
runs-on: ${{ github.event.inputs.hardware || 'gaudi' }} #xeon #gaudi
steps:
- name: Clean Up Working Directory
run: sudo rm -rf ${{github.workspace}}/*
- name: Checkout out Repo
uses: actions/checkout@v4
- name: Clone repo GenAIEval
run: |
git clone https://github.com/opea-project/GenAIEval.git
cd GenAIEval && git checkout v0.6
- name: Run test
env:
HUGGINGFACEHUB_API_TOKEN: ${{ secrets.HUGGINGFACEHUB_API_TOKEN }}
GOOGLE_CSE_ID: ${{ secrets.GOOGLE_CSE_ID }}
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
hardware: ${{ github.event.inputs.hardware || 'gaudi' }} #xeon
mode: perf
IMAGE_TAG: latest
IMAGE_REPO_GAUDI: ${{ vars.IMAGE_REPO_GAUDI }}
IMAGE_REPO_XEON: ${{ vars.IMAGE_REPO_XEON }}
run: |
# cd ${{ github.workspace }}/$example/tests
cd ${{ github.workspace }}/ChatQnA/tests
cp ../../GenAIEval/evals/benchmark/chatqna_benchmark.py .
cp ../../GenAIEval/evals/benchmark/data.json ${{ github.workspace }}/ChatQnA/docker/${hardware}/
if [ "$hardware" == "gaudi" ]; then IMAGE_REPO=$IMAGE_REPO_GAUDI; else IMAGE_REPO=$IMAGE_REPO_XEON; fi
export IMAGE_REPO=${IMAGE_REPO}
# example_l=$(echo $example | tr '[:upper:]' '[:lower:]')
if [ -f test_chatqna_on_${hardware}.sh ]; then timeout 30m bash test_chatqna_on_${hardware}.sh > ${hardware}_output.log; else echo "Test script not found, skip test!"; fi
- name: Process log and save to JSON
env:
hardware: ${{ github.event.inputs.hardware || 'gaudi' }} #xeon
run: |
cd ${{ github.workspace }}/ChatQnA/tests
echo '{}' > ${hardware}_output.json
echo $(grep -a 'Total Requests:' ${hardware}_output.log | awk '{print "{\"total_requests\": \""$3 "\"}"}') > ${hardware}_output.json
echo $(grep -a 'P50 latency is' ${hardware}_output.log | awk '{print "{\"p50_latency\": \""$4 "\"}"}') >> ${hardware}_output.json
echo $(grep -a 'P99 latency is' ${hardware}_output.log | awk '{print "{\"p99_latency\": \""$4 "\"}"}') >> ${hardware}_output.json
jq -s 'add' ${hardware}_output.json > ${hardware}_final_output.json && mv ${hardware}_final_output.json ${hardware}_output.json
- name: Publish pipeline artifact
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
path: |
${{ github.workspace }}/ChatQnA/tests/*.log
${{ github.workspace }}/ChatQnA/tests/*.json