Skip to content

Commit fa46093

Browse files
committed
adding pr label auto validation
1 parent 700f305 commit fa46093

1 file changed

Lines changed: 120 additions & 0 deletions

File tree

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: PR Label Validation
2+
run-name: Validate ${{ github.event.label.name }} PR \#${{ github.event.pull_request.number }}
3+
4+
on:
5+
pull_request:
6+
types: [labeled]
7+
branches:
8+
- main
9+
10+
jobs:
11+
parse-label:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
runner-type: ${{ steps.parse-label.outputs.runner-type }}
15+
model-prefix: ${{ steps.parse-label.outputs.model-prefix }}
16+
steps:
17+
- name: Parse label
18+
shell: python
19+
run: |
20+
import yaml
21+
import re
22+
with open(runners_config, 'r') as f:
23+
runners = yaml.safe_load(f)
24+
25+
# Matches strings like h200-trt_gptoss
26+
runner_model_pattern = r'^([^_]+)_([^_]+)$'
27+
match = re.match(runner_model_pattern, '${{ github.event.label.name }}')
28+
if match:
29+
runner_type = match.group(1)
30+
model_prefix = match.group(2)
31+
32+
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
33+
f.write(f'runner-type={runner_type}\n')
34+
f.write(f'model-prefix={model_prefix}\n')
35+
36+
37+
38+
get-jobs:
39+
needs: parse-label
40+
if: ${{ needs.parse-label.outputs.runner-type != '' && needs.parse-label.outputs.model-prefix != ''}}
41+
runs-on: ubuntu-latest
42+
outputs:
43+
search-space-config: ${{ steps.get-jobs.outputs.search-space-config }}
44+
steps:
45+
- name: Checkout code
46+
uses: actions/checkout@v4
47+
48+
- id: get-jobs
49+
run: |
50+
pip install pydantic
51+
CONFIG_JSON=$(python3 ${GITHUB_WORKSPACE}/utils/matrix-logic/generate_sweep_configs.py \
52+
full-sweep \
53+
--runner-type ${{ needs.parse-label.outputs.runner-type }} \
54+
--model-prefix ${{ needs.parse-label.outputs.model-prefix }} \
55+
--seq-lens 1k1k \
56+
--test-mode \
57+
--config-files \
58+
.github/configs/nvidia-master.yaml \
59+
.github/configs/amd-master.yaml \
60+
--runner-config .github/configs/runners.yaml)
61+
echo "search-space-config=$CONFIG_JSON" >> $GITHUB_OUTPUT
62+
63+
validate:
64+
needs: get-jobs
65+
# Prolly unnecessary
66+
if: ${{ needs.get-jobs.outputs.search-space-config != '[]' }}
67+
uses: ./.github/workflows/benchmark-tmpl.yml
68+
name: Validate ${{ github.event.label.name }}
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
config: ${{ fromJson(needs.get-jobs.outputs.search-space-config) }}
73+
secrets: inherit
74+
with:
75+
exp-name: ${{ matrix.config.exp-name }}
76+
isl: ${{ matrix.config.isl }}
77+
osl: ${{ matrix.config.osl }}
78+
max-model-len: ${{ matrix.config.max-model-len }}
79+
runner: ${{ matrix.config.runner }}
80+
image: ${{ matrix.config.image }}
81+
model: ${{ matrix.config.model }}
82+
framework: ${{ matrix.config.framework }}
83+
precision: ${{ matrix.config.precision }}
84+
tp: ${{ matrix.config.tp }}
85+
ep: ${{ matrix.config.ep }}
86+
dp-attn: ${{ matrix.config.dp-attn }}
87+
conc: ${{ matrix.config.conc }}
88+
89+
calc-success-rate:
90+
needs: validate
91+
if: ${{ always() }}
92+
runs-on: ubuntu-latest
93+
94+
env:
95+
RESULTS_DIR: "results/"
96+
STATS_FILENAME: "run_stats"
97+
GITHUB_TOKEN: ${{ secrets.REPO_PAT }}
98+
99+
steps:
100+
- uses: actions/checkout@v3
101+
with:
102+
token: ${{ secrets.REPO_PAT }}
103+
fetch-depth: 0
104+
105+
- name: Download results artifacts
106+
uses: actions/download-artifact@v4
107+
with:
108+
path: ${{ env.RESULTS_DIR }}
109+
pattern: results_*
110+
111+
- name: Install python dependencies
112+
run: pip install PyGithub
113+
114+
- name: Calculate success rate
115+
run: python3 utils/calc_success_rate.py $STATS_FILENAME
116+
117+
- uses: actions/upload-artifact@v4
118+
with:
119+
name: "run-stats"
120+
path: ${{ env.STATS_FILENAME }}.json

0 commit comments

Comments
 (0)