Skip to content

Commit 3e55d9e

Browse files
zhangxinyuehfadwangxiaoxin (A)
authored andcommitted
[CI] Make accuarcy CI and report work (vllm-project#1078)
### What this PR does / why we need it? Make accuarcy CI and report work ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Manaully review Signed-off-by: hfadzxy <starmoon_zhang@163.com> Signed-off-by: wangxiaoxin (A) <wangxiaoxin7@huawei.com>
1 parent 9181e92 commit 3e55d9e

File tree

5 files changed

+170
-82
lines changed

5 files changed

+170
-82
lines changed

.github/workflows/accuracy_report.yaml

Lines changed: 149 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -19,110 +19,184 @@ name: Accuracy Report
1919
on:
2020
workflow_dispatch:
2121
inputs:
22-
branch:
23-
description: 'choose a dev branch to pr'
22+
vllm-ascend-branch:
23+
description: 'vllm-ascend branch:'
2424
required: true
25-
vllm-ascend-version:
26-
description: 'what vllm-ascend version to accuracy test?'
25+
type: choice
26+
options:
27+
- main
28+
- v0.7.3-dev
29+
models:
30+
description: 'models:'
2731
required: true
28-
type: string
32+
type: choice
33+
options:
34+
- all
35+
- Qwen/Qwen2.5-7B-Instruct
36+
- Qwen/Qwen2.5-VL-7B-Instruct
37+
- Qwen/Qwen3-8B-Base
38+
default: 'all'
39+
2940
jobs:
30-
download:
41+
download_reports:
3142
runs-on: ubuntu-latest
43+
strategy:
44+
matrix:
45+
model: ${{ fromJSON(
46+
(github.event.inputs.models == 'all' &&
47+
'["Qwen/Qwen2.5-7B-Instruct","Qwen/Qwen2.5-VL-7B-Instruct","Qwen/Qwen3-8B-Base"]') ||
48+
(github.event.inputs.models == 'Qwen/Qwen2.5-7B-Instruct' &&
49+
'["Qwen/Qwen2.5-7B-Instruct"]') ||
50+
(github.event.inputs.models == 'Qwen/Qwen2.5-VL-7B-Instruct' &&
51+
'["Qwen/Qwen2.5-VL-7B-Instruct"]') ||
52+
(github.event.inputs.models == 'Qwen/Qwen3-8B-Base' &&
53+
'["Qwen/Qwen3-8B-Base"]')
54+
) }}
55+
56+
version: [0, 1]
57+
exclude:
58+
- model: 'Qwen/Qwen2.5-VL-7B-Instruct'
59+
version: 1
60+
fail-fast: false
61+
62+
name: Download ${{ matrix.model }} V${{ matrix.version }}
3263
steps:
3364
- name: Checkout repository
3465
uses: actions/checkout@v4
3566
with:
36-
ref: ${{ github.event.inputs.branch }}
37-
38-
- name: Debug List Artifacts
39-
run: gh api /repos/${{ github.repository }}/actions/artifacts
40-
env:
41-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
ref: ${{ github.event.inputs.vllm-ascend-branch }}
4268

43-
- name: Query artifact run id for Qwen2.5-VL-7B-Instruct V0 latest artifact
44-
id: get_Qwen2_5_VL_7B_Instruct_latest_run_id_V0
69+
- name: Get base model name
70+
id: get_basename
4571
run: |
46-
ARTIFACT_JSON=$(gh api "repos/${{ github.repository }}/actions/artifacts")
47-
RUN_ID=$(echo "$ARTIFACT_JSON" | \
48-
jq -r '[.artifacts[] | select(.name=="${{ github.event.inputs.vllm-ascend-version }}-Qwen2.5-VL-7B-Instruct-V0-report")] | sort_by(.created_at) | last | .workflow_run.id')
49-
echo "runid=$RUN_ID" >> "$GITHUB_OUTPUT"
50-
env:
51-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
model_base_name=$(basename "${{ matrix.model }}")
73+
echo "model_base_name=$model_base_name" >> $GITHUB_OUTPUT
74+
shell: bash
5275

53-
- name: Query artifact run id for Qwen2.5-7B-Instruct V0 latest artifact
54-
id: get_Qwen2_5_7B_Instruct_latest_run_id_V0
76+
- name: Query artifact run id
77+
id: get_run_id
5578
run: |
56-
ARTIFACT_JSON=$(gh api "repos/${{ github.repository }}/actions/artifacts")
79+
ARTIFACT_PATTERN="${{ github.event.inputs.vllm-ascend-branch }}-${{ steps.get_basename.outputs.model_base_name }}-V${{ matrix.version }}-report"
80+
echo "Querying artifacts with pattern: $ARTIFACT_PATTERN"
81+
82+
ARTIFACT_JSON=$(gh api --paginate /repos/${{ github.repository }}/actions/artifacts || echo "{}")
83+
5784
RUN_ID=$(echo "$ARTIFACT_JSON" | \
58-
jq -r '[.artifacts[] | select(.name=="${{ github.event.inputs.vllm-ascend-version }}-Qwen2.5-7B-Instruct-V0-report")] | sort_by(.created_at) | last | .workflow_run.id')
59-
echo "runid=$RUN_ID" >> "$GITHUB_OUTPUT"
85+
jq -s -r --arg pattern "$ARTIFACT_PATTERN" \
86+
'[.[].artifacts[]] | map(select(.name | test($pattern))) | sort_by(.created_at) | last | .workflow_run.id // empty')
87+
88+
if [ -z "$RUN_ID" ]; then
89+
echo "::warning::No artifact found matching pattern $ARTIFACT_PATTERN. Skipping download."
90+
echo "runid=" >> $GITHUB_OUTPUT
91+
else
92+
echo "Found matching artifact with run ID: $RUN_ID"
93+
echo "runid=$RUN_ID" >> $GITHUB_OUTPUT
94+
fi
6095
env:
61-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6297

63-
- name: Query artifact run id for Qwen3-8B-Base V0 latest artifact
64-
id: get_Qwen3_8B_Base_latest_run_id_V0
65-
run: |
66-
ARTIFACT_JSON=$(gh api "repos/${{ github.repository }}/actions/artifacts")
67-
RUN_ID=$(echo "$ARTIFACT_JSON" | \
68-
jq -r '[.artifacts[] | select(.name=="${{ github.event.inputs.vllm-ascend-version }}-Qwen3-8B-Base-V0-report")] | sort_by(.created_at) | last | .workflow_run.id')
69-
echo "runid=$RUN_ID" >> "$GITHUB_OUTPUT"
70-
env:
71-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72-
73-
- name: Download Qwen/Qwen2.5-VL-7B-Instruct V0 Artifact
98+
- name: Download Artifact
99+
if: ${{ steps.get_run_id.outputs.runid != '' }}
74100
uses: actions/download-artifact@v4
75101
with:
76-
name: ${{ github.event.inputs.vllm-ascend-version }}-Qwen2.5-VL-7B-Instruct-V0-report
77-
path: ./docs/source/developer_guide/evaluation/accuracy_report
78-
github-token: ${{ secrets.GITHUB_TOKEN }}
79-
repository: vllm-project/vllm-ascend
80-
run-id: ${{ steps.get_Qwen2_5_VL_7B_Instruct_latest_run_id_V0.outputs.runid }}
102+
name: ${{ github.event.inputs.vllm-ascend-branch }}-${{ steps.get_basename.outputs.model_base_name }}-V${{ matrix.version }}-report
103+
path: ./docs/source/developer_guide/evaluation/accuracy_report_bak
104+
github-token: ${{ secrets.GITHUB_TOKEN }}
105+
repository: ${{ github.repository }}
106+
run-id: ${{ steps.get_run_id.outputs.runid }}
107+
108+
- name: Upload reports artifact
109+
if: ${{ steps.get_run_id.outputs.runid != '' }}
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: report-${{ steps.get_basename.outputs.model_base_name }}-v${{ matrix.version }}
113+
path: ./docs/source/developer_guide/evaluation/accuracy_report_bak/*.md
114+
retention-days: 90
81115

82-
- name: Download Qwen/Qwen2.5-7B-Instruct Artifact
83-
uses: actions/download-artifact@v4
116+
create_pr:
117+
runs-on: ubuntu-latest
118+
needs: download_reports
119+
steps:
120+
- name: Checkout repository
121+
uses: actions/checkout@v4
84122
with:
85-
name: ${{ github.event.inputs.vllm-ascend-version }}-Qwen2.5-7B-Instruct-V0-report
86-
path: ./docs/source/developer_guide/evaluation/accuracy_report
87-
github-token: ${{ secrets.GITHUB_TOKEN }}
88-
repository: vllm-project/vllm-ascend
89-
run-id: ${{ steps.get_Qwen2_5_7B_Instruct_latest_run_id_V0.outputs.runid }}
123+
ref: ${{ github.event.inputs.vllm-ascend-branch }}
124+
125+
- name: Setup workspace
126+
run: mkdir -p ./accuracy/accuracy_report
90127

91-
- name: Download Qwen/Qwen3-8B-Base Artifact
128+
- name: Download only current run reports
92129
uses: actions/download-artifact@v4
93130
with:
94-
name: ${{ github.event.inputs.vllm-ascend-version }}-Qwen3-8B-Base-V0-report
95131
path: ./docs/source/developer_guide/evaluation/accuracy_report
132+
pattern: report-*
96133
github-token: ${{ secrets.GITHUB_TOKEN }}
97-
repository: vllm-project/vllm-ascend
98-
run-id: ${{ steps.get_Qwen3_8B_Base_latest_run_id_V0.outputs.runid }}
134+
run-id: ${{ github.run_id }}
135+
136+
- name: Delete old report
137+
run: |
138+
find ./docs/source/developer_guide/evaluation/accuracy_report -maxdepth 1 -type f -name '*.md' ! -name 'index.md' -delete
139+
find ./docs/source/developer_guide/evaluation/accuracy_report -mindepth 2 -type f -name '*.md' -exec mv -f {} ./docs/source/developer_guide/evaluation/accuracy_report \;
140+
find ./docs/source/developer_guide/evaluation/accuracy_report -mindepth 1 -type d -empty -delete
99141
100-
- name: Display Files
101-
working-directory: ./docs/source/developer_guide/evaluation/accuracy_report
142+
- name: Generate step summary
143+
if: ${{ always() }}
102144
run: |
103-
cat ./Qwen2.5-VL-7B-Instruct.md
104-
cat ./Qwen2.5-7B-Instruct.md
105-
cat ./Qwen3-8B-Base.md
106-
107-
- name: Create Pull Request for markdown update
145+
for report in ./docs/source/developer_guide/evaluation/accuracy_report/*.md; do
146+
filename=$(basename "$report")
147+
# skip index.md
148+
if [ "$filename" = "index.md" ]; then
149+
continue
150+
fi
151+
152+
if [ -f "$report" ]; then
153+
{
154+
echo -e "\n\n---\n"
155+
echo "## 📄 Report File: $(basename $report)"
156+
cat "$report"
157+
} >> "$GITHUB_STEP_SUMMARY"
158+
fi
159+
done
160+
161+
- name: Update accuracy_report/index.md
162+
run: |
163+
REPORT_DIR="./docs/source/developer_guide/evaluation/accuracy_report"
164+
INDEX_MD="$REPORT_DIR/index.md"
165+
166+
{
167+
echo "# Accuracy Report"
168+
echo ""
169+
echo "::: {toctree}"
170+
echo ":caption: Accuracy Report"
171+
echo ":maxdepth: 1"
172+
173+
for report in "$REPORT_DIR"/*.md; do
174+
filename="$(basename "$report" .md)"
175+
if [ "$filename" != "index" ]; then
176+
echo "$filename"
177+
fi
178+
done
179+
180+
echo ":::"
181+
} > "$INDEX_MD"
182+
183+
- name: Create Pull Request
108184
uses: peter-evans/create-pull-request@v7
109185
with:
110186
token: ${{ secrets.PR_TOKEN }}
111-
base: ${{ github.event.inputs.branch }}
112-
branch: auto-pr/accuracy-test
113-
commit-message: "Update accuracy report for ${{ github.event.inputs.branch }}"
187+
base: ${{ github.event.inputs.vllm-ascend-branch }}
188+
branch: auto-pr/accuracy-report
189+
commit-message: "Update accuracy reports for ${{ github.event.inputs.vllm-ascend-branch }}"
114190
add-paths: ./docs/source/developer_guide/evaluation/accuracy_report/*.md
115-
title: "[Doc]Update accuracy report for ${{ github.event.inputs.branch }}"
191+
title: "[Doc] Update accuracy reports for ${{ github.event.inputs.vllm-ascend-branch }}"
116192
body: |
117-
The accuracy results running on Ascend NPU have changed, I'm updating the report.
118-
Please review the changes.
119-
193+
The accuracy results running on NPU Altlas A2 have changed, updating reports for:
194+
${{
195+
github.event.inputs.models == 'all'
196+
&& 'All models (Qwen2.5-7B-Instruct, Qwen2.5-VL-7B-Instruct, Qwen3-8B-Base)'
197+
|| github.event.inputs.models
198+
}}
199+
120200
- [Workflow run][1]
121-
- [Qwen2.5-7B-Instruct accuracy report][2]
122-
- [Qwen2.5-VL-7B-Instruct accuracy report][3]
123-
- [Qwen3-8B-Base accuracy report][4]
124-
125-
[1]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
126-
[2]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ steps.get_Qwen2_5_7B_Instruct_latest_run_id_V0.outputs.runid }}
127-
[3]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ steps.get_Qwen2_5_VL_7B_Instruct_latest_run_id_V0.outputs.runid }}
128-
[4]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ steps.get_Qwen3_8B_Base_latest_run_id_V0.outputs.runid }}
201+
202+
[1]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

.github/workflows/accuracy_test.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
# - vl-accuracy-test: Qwen/Qwen2.5-VL-7B-Instruct
9797
model_name: ${{ fromJSON(
9898
(github.event.inputs.models == 'all' &&
99-
'["Qwen/Qwen2.5-7B-Instruct","Qwen/Qwen2.5-VL-7B-Instruct","model_name":"Qwen/Qwen3-8B-Base"]') ||
99+
'["Qwen/Qwen2.5-7B-Instruct","Qwen/Qwen2.5-VL-7B-Instruct","Qwen/Qwen3-8B-Base"]') ||
100100
(github.event.inputs.models == 'Qwen/Qwen2.5-7B-Instruct' &&
101101
'["Qwen/Qwen2.5-7B-Instruct"]') ||
102102
(github.event.inputs.models == 'Qwen/Qwen2.5-VL-7B-Instruct' &&
@@ -201,6 +201,7 @@ jobs:
201201
pip show torch | grep "Version:" | awk '{print "GHA_TORCH_VERSION="$2}'
202202
pip show torch_npu | grep "Version:" | awk '{print "GHA_TORCH_NPU_VERSION="$2}'
203203
pip show vllm | grep "Version:" | awk '{print "GHA_VLLM_VERSION="$2}' | sed 's/+.*//'
204+
echo "GHA_VLLM_ASCEND_VERSION=${{ github.event.inputs.vllm-ascend-version || github.ref }}"
204205
} >> "$GITHUB_ENV"
205206
206207
- name: Print versions
@@ -209,7 +210,7 @@ jobs:
209210
echo "Torch NPU: ${{ env.GHA_TORCH_NPU_VERSION }}"
210211
echo "Torch: ${{ env.GHA_TORCH_VERSION }}"
211212
echo "vLLM: ${{ env.GHA_VLLM_VERSION }}"
212-
echo "vLLM Ascend: ${{ env.GHA_VLLM_ASCEND_VERSION || github.ref }}"
213+
echo "vLLM Ascend: ${{ env.GHA_VLLM_ASCEND_VERSION }}"
213214
214215
- name: Run Accuracy Test for V${{ matrix.vllm_use_version }}
215216
id: report
@@ -238,10 +239,16 @@ jobs:
238239
run: |
239240
cat ./benchmarks/accuracy/${{ steps.report.outputs.markdown_name }}.md >> $GITHUB_STEP_SUMMARY
240241
242+
- name: Sanitize version string for artifact naming
243+
run: |
244+
SAFE_VLLM_ASCEND_VERSION="${GHA_VLLM_ASCEND_VERSION//\//-}"
245+
echo "SAFE_VLLM_ASCEND_VERSION=$SAFE_VLLM_ASCEND_VERSION" >> "$GITHUB_ENV"
246+
241247
- name: Upload Report for V${{ matrix.vllm_use_version }}
248+
if: ${{ github.event_name == 'workflow_dispatch' }}
242249
uses: actions/upload-artifact@v4
243250
with:
244-
name: "${{ env.GHA_VLLM_ASCEND_VERSION }}-${{ steps.report.outputs.markdown_name }}-report"
251+
name: "${{ env.SAFE_VLLM_ASCEND_VERSION }}-${{ steps.report.outputs.markdown_name }}-report"
245252
path: ./benchmarks/accuracy/${{ steps.report.outputs.markdown_name }}.md
246253
if-no-files-found: warn
247254
retention-days: 90

benchmarks/scripts/run_accuracy.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import lm_eval
2727
import torch
2828

29-
UNIMODAL_MODEL_NAME = ["Qwen/Qwen2.5-7B-Instruct", "Qwen/Qwen3-8B"]
29+
UNIMODAL_MODEL_NAME = ["Qwen/Qwen2.5-7B-Instruct", "Qwen/Qwen3-8B-Base"]
3030
UNIMODAL_TASK = ["ceval-valid", "gsm8k"]
3131
MULTIMODAL_NAME = ["Qwen/Qwen2.5-VL-7B-Instruct"]
3232
MULTIMODAL_TASK = ["mmmu_val"]
@@ -36,17 +36,17 @@
3636
MODEL_RUN_INFO = {
3737
"Qwen/Qwen2.5-7B-Instruct":
3838
("export MODEL_ARGS='pretrained={model}, max_model_len=4096,dtype=auto,tensor_parallel_size=2,gpu_memory_utilization=0.6'\n"
39-
"lm_eval --model vllm --modlel_args $MODEL_ARGS --tasks {datasets} \ \n"
39+
"lm_eval --model vllm --model_args $MODEL_ARGS --tasks {datasets} \ \n"
4040
"--apply_chat_template --fewshot_as_multiturn --num_fewshot 5 --batch_size 1"
4141
),
4242
"Qwen/Qwen3-8B-Base":
4343
("export MODEL_ARGS='pretrained={model}, max_model_len=4096,dtype=auto,tensor_parallel_size=2,gpu_memory_utilization=0.6'\n"
44-
"lm_eval --model vllm --modlel_args $MODEL_ARGS --tasks {datasets} \ \n"
44+
"lm_eval --model vllm --model_args $MODEL_ARGS --tasks {datasets} \ \n"
4545
"--apply_chat_template --fewshot_as_multiturn --num_fewshot 5 --batch_size 1"
4646
),
4747
"Qwen/Qwen2.5-VL-7B-Instruct":
4848
("export MODEL_ARGS='pretrained={model}, max_model_len=8192,dtype=auto,tensor_parallel_size=4,max_images=2'\n"
49-
"lm_eval --model vllm-vlm --modlel_args $MODEL_ARGS --tasks {datasets} \ \n"
49+
"lm_eval --model vllm-vlm --model_args $MODEL_ARGS --tasks {datasets} \ \n"
5050
"--apply_chat_template --fewshot_as_multiturn --batch_size 1"),
5151
}
5252

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Accuracy Report
2+
3+
:::{toctree}
4+
:caption: Accuracy Report
5+
:maxdepth: 1
6+
:::

docs/source/developer_guide/evaluation/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using_lm_eval
77
using_opencompass
88
using_evalscope
9+
accuracy_report/index
910
:::
1011

1112
:::{toctree}

0 commit comments

Comments
 (0)