mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-10-25 10:53:42 +08:00
04098893d9
these models will fail, look at workflow, likely need env setup now that we use recursion
70 lines
2.3 KiB
YAML
70 lines
2.3 KiB
YAML
name: Test Models Compatibility With Tinygrad Changes
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'tinygrad_repo'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
generate-matrix:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
models: ${{ steps.set-matrix.outputs.models }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Fetch and Parse json
|
|
id: set-matrix
|
|
run: |
|
|
python3 -c '
|
|
import json, urllib.request, os, re
|
|
|
|
with open("openpilot/sunnypilot/models/fetcher.py", "r") as f:
|
|
urls = re.findall(r"MODEL_URL(?:_CHESTNUT)?\s*=\s*[\"'"'"']([^\"'"'"']+)[\"'"'"']", f.read())
|
|
|
|
artifacts = []
|
|
for url in urls:
|
|
data = json.loads(urllib.request.urlopen(url).read())
|
|
for bundle in data.get("bundles", []):
|
|
for model in bundle.get("models", []):
|
|
if "artifact" in model:
|
|
artifacts.append(model["artifact"])
|
|
|
|
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
|
|
f.write(f"models={json.dumps(artifacts)}\n")
|
|
'
|
|
|
|
test-model:
|
|
name: Test ${{ matrix.artifact.file_name }}
|
|
needs: generate-matrix
|
|
runs-on: ubuntu-latest
|
|
container: ghcr.io/commaai/openpilot-base:latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
artifact: ${{ fromJson(needs.generate-matrix.outputs.models) }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Download model
|
|
env:
|
|
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
|
MODEL_URL: ${{ matrix.artifact.download_uri.url }}
|
|
MODEL_FILE: ${{ matrix.artifact.file_name }}
|
|
shell: bash
|
|
run: |
|
|
mkdir -p /tmp/models
|
|
AUTH=()
|
|
if [ -n "$HF_TOKEN" ]; then AUTH=(-H "Authorization: Bearer $HF_TOKEN"); fi
|
|
curl --retry 3 --retry-all-errors -s -S -f -L "${AUTH[@]}" -o "/tmp/models/$MODEL_FILE" "$MODEL_URL"
|
|
|
|
- name: Run Model Compatibility Test
|
|
env:
|
|
MODEL_BASE_NAME: ${{ matrix.artifact.file_name }}
|
|
MODEL_DIR: "/tmp/models"
|
|
run: |
|
|
export PYTHONPATH="$GITHUB_WORKSPACE/tinygrad_repo:$GITHUB_WORKSPACE:$PYTHONPATH"
|
|
python3 -m pip uninstall -y tinygrad || uv pip uninstall -y tinygrad --system || true
|
|
python3 -m pytest openpilot/sunnypilot/modeld_v2/tests/test_models.py
|