File tree 2 files changed +73
-0
lines changed 2 files changed +73
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : " model review"
2
+
3
+ on :
4
+ pull_request :
5
+ types : [opened, reopened, synchronize]
6
+ paths :
7
+ - ' selfdrive/modeld/models/*.onnx'
8
+ workflow_dispatch :
9
+
10
+ jobs :
11
+ comment :
12
+ permissions :
13
+ contents : read
14
+ pull-requests : write
15
+ runs-on : ubuntu-latest
16
+ if : github.repository == 'commaai/openpilot'
17
+ steps :
18
+ - name : Checkout
19
+ uses : actions/checkout@v4
20
+ - name : Checkout master
21
+ uses : actions/checkout@v4
22
+ with :
23
+ ref : master
24
+ path : base
25
+ - run : git lfs pull
26
+ - run : cd base && git lfs pull
27
+
28
+ - run : pip install onnx
29
+
30
+ - name : scripts/reporter.py
31
+ id : report
32
+ run : |
33
+ echo "content<<EOF" >> $GITHUB_OUTPUT
34
+ echo "## Model Review" >> $GITHUB_OUTPUT
35
+ MASTER_PATH=${{ github.workspace }}/base python scripts/reporter.py >> $GITHUB_OUTPUT
36
+ echo "EOF" >> $GITHUB_OUTPUT
37
+
38
+ - name : Post model report comment
39
+ uses : marocchino/sticky-pull-request-comment@baa7203ed60924babbe5dcd0ac8eae3b66ec5e16
40
+ with :
41
+ header : model-review
42
+ message : ${{ steps.report.outputs.content }}
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+ import os
3
+ import glob
4
+ import onnx
5
+
6
+ BASEDIR = os .path .abspath (os .path .join (os .path .dirname (os .path .realpath (__file__ )), "../" ))
7
+ MASTER_PATH = os .getenv ("MASTER_PATH" , BASEDIR )
8
+ MODEL_PATH = "/selfdrive/modeld/models/"
9
+
10
+ def get_checkpoint (f ):
11
+ model = onnx .load (f )
12
+ metadata = {prop .key : prop .value for prop in model .metadata_props }
13
+ return metadata ['model_checkpoint' ].split ('/' )[0 ]
14
+
15
+ if __name__ == "__main__" :
16
+ print ("| | master | PR branch |" )
17
+ print ("|-| ----- | --------- |" )
18
+
19
+ for f in glob .glob (BASEDIR + MODEL_PATH + "/*.onnx" ):
20
+ # TODO: add checkpoint to DM
21
+ if "dmonitoring" in f :
22
+ continue
23
+
24
+ fn = os .path .basename (f )
25
+ master = get_checkpoint (MASTER_PATH + MODEL_PATH + fn )
26
+ pr = get_checkpoint (BASEDIR + MODEL_PATH + fn )
27
+ print (
28
+ "|" , fn , "|" ,
29
+ f"[{ master } ](https://reporter.comma.life/experiment/{ master } )" , "|" ,
30
+ f"[{ pr } ](https://reporter.comma.life/experiment/{ pr } )" , "|"
31
+ )
You can’t perform that action at this time.
0 commit comments