CI: comment reporter links on PRs (#35066)
* comment * Revert "Tomb Raider 4 (#35058)" This reverts commitpull/34992/merge756aebd39f
. * no dpeth * Reapply "Tomb Raider 4 (#35058)" This reverts commit7143835b3d
. * no forks
parent
756aebd39f
commit
37e86df41e
2 changed files with 73 additions and 0 deletions
@ -0,0 +1,42 @@ |
||||
name: "model review" |
||||
|
||||
on: |
||||
pull_request: |
||||
types: [opened, reopened, synchronize] |
||||
paths: |
||||
- 'selfdrive/modeld/models/*.onnx' |
||||
workflow_dispatch: |
||||
|
||||
jobs: |
||||
comment: |
||||
permissions: |
||||
contents: read |
||||
pull-requests: write |
||||
runs-on: ubuntu-latest |
||||
if: github.repository == 'commaai/openpilot' |
||||
steps: |
||||
- name: Checkout |
||||
uses: actions/checkout@v4 |
||||
- name: Checkout master |
||||
uses: actions/checkout@v4 |
||||
with: |
||||
ref: master |
||||
path: base |
||||
- run: git lfs pull |
||||
- run: cd base && git lfs pull |
||||
|
||||
- run: pip install onnx |
||||
|
||||
- name: scripts/reporter.py |
||||
id: report |
||||
run: | |
||||
echo "content<<EOF" >> $GITHUB_OUTPUT |
||||
echo "## Model Review" >> $GITHUB_OUTPUT |
||||
MASTER_PATH=${{ github.workspace }}/base python scripts/reporter.py >> $GITHUB_OUTPUT |
||||
echo "EOF" >> $GITHUB_OUTPUT |
||||
|
||||
- name: Post model report comment |
||||
uses: marocchino/sticky-pull-request-comment@baa7203ed60924babbe5dcd0ac8eae3b66ec5e16 |
||||
with: |
||||
header: model-review |
||||
message: ${{ steps.report.outputs.content }} |
@ -0,0 +1,31 @@ |
||||
#!/usr/bin/env python3 |
||||
import os |
||||
import glob |
||||
import onnx |
||||
|
||||
BASEDIR = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../")) |
||||
MASTER_PATH = os.getenv("MASTER_PATH", BASEDIR) |
||||
MODEL_PATH = "/selfdrive/modeld/models/" |
||||
|
||||
def get_checkpoint(f): |
||||
model = onnx.load(f) |
||||
metadata = {prop.key: prop.value for prop in model.metadata_props} |
||||
return metadata['model_checkpoint'].split('/')[0] |
||||
|
||||
if __name__ == "__main__": |
||||
print("| | master | PR branch |") |
||||
print("|-| ----- | --------- |") |
||||
|
||||
for f in glob.glob(BASEDIR + MODEL_PATH + "/*.onnx"): |
||||
# TODO: add checkpoint to DM |
||||
if "dmonitoring" in f: |
||||
continue |
||||
|
||||
fn = os.path.basename(f) |
||||
master = get_checkpoint(MASTER_PATH + MODEL_PATH + fn) |
||||
pr = get_checkpoint(BASEDIR + MODEL_PATH + fn) |
||||
print( |
||||
"|", fn, "|", |
||||
f"[{master}](https://reporter.comma.life/experiment/{master})", "|", |
||||
f"[{pr}](https://reporter.comma.life/experiment/{pr})", "|" |
||||
) |
Loading…
Reference in new issue