From 302f3ad892038144edabc5626bda2294a4ff9b11 Mon Sep 17 00:00:00 2001 From: James Vecellio-Grant <159560811+Discountchubbs@users.noreply.github.com> Date: Fri, 4 Sep 2026 16:52:09 -0700 Subject: [PATCH] ci: compile dm warp (#1989) --- .github/workflows/build-default-models.yaml | 18 ++++++++++++++++++ .../download-hf-model-chunks/action.yml | 7 +++++++ 2 files changed, 25 insertions(+) diff --git a/.github/workflows/build-default-models.yaml b/.github/workflows/build-default-models.yaml index d748d3ac1..4f22002ae 100644 --- a/.github/workflows/build-default-models.yaml +++ b/.github/workflows/build-default-models.yaml @@ -484,11 +484,29 @@ jobs: print(f'Chunked {pkl} into {len(targets)} chunks') " + - name: Compile DM warp + run: | + source ${UV_PROJECT_ENVIRONMENT}/bin/activate + export PYTHONPATH="${PYTHONPATH}:${{ github.workspace }}/tinygrad_repo:${{ github.workspace }}" + + TG_FLAGS="DEV=QCOM IMAGE=1 FLOAT16=1 NOLOCALS=1 JIT_BATCH_SIZE=0 OPENPILOT_HACKS=1" + MODEL_DIR="${{ github.workspace }}/openpilot/selfdrive/modeld" + DM_SIZE=$(python3 -c "from openpilot.common.transformations.model import DM_INPUT_SIZE as s; print(f'{s[0]}x{s[1]}')") + + for res in $(python3 -c "from openpilot.common.transformations.camera import _ar_ox_fisheye as a, _os_fisheye as o; print(f'{a.width}x{a.height} {o.width}x{o.height}')"); do + WARP_PKL="${MODEL_DIR}/models/dm_warp_${res}_tinygrad.pkl" + taskset -c 7 env ${TG_FLAGS} python3 ${MODEL_DIR}/compile_dm_warp.py \ + --camera-resolution ${res} \ + --warp-to ${DM_SIZE} \ + --output ${WARP_PKL} + done + - name: Prepare DM output run: | mkdir -p dm_output cp ${{ github.workspace }}/${{ env.DM_PKL }}.chunk* dm_output/ cp ${{ github.workspace }}/${{ env.DM_PKL }}.chunkmanifest dm_output/ + cp ${{ github.workspace }}/openpilot/selfdrive/modeld/models/dm_warp_* dm_output/ - name: Upload DM artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/download-hf-model-chunks/action.yml b/.github/workflows/download-hf-model-chunks/action.yml index 01ab5385d..677385f1d 100644 --- a/.github/workflows/download-hf-model-chunks/action.yml +++ b/.github/workflows/download-hf-model-chunks/action.yml @@ -46,6 +46,13 @@ runs: printf '%s\t%s\n' "$ENCODED_URL" "${DEST_DIR}/${CANONICAL}.chunk${CHUNK_IDX}" >> "$DOWNLOAD_LIST" done < <(echo "$ARTIFACT" | jq -r '.chunks[].file_name') echo "$NUM_CHUNKS" > "${DEST_DIR}/${CANONICAL}.chunkmanifest" + + if [ "$CANONICAL" = "dmonitoring_model_tinygrad.pkl" ]; then + for warp in dm_warp_1928x1208_tinygrad.pkl dm_warp_1344x760_tinygrad.pkl; do + ENCODED_URL=$(python3 -c "import urllib.parse; print(urllib.parse.quote('${BASE_URL}/${warp}', safe=':/'))") + printf '%s\t%s\n' "$ENCODED_URL" "${DEST_DIR}/${warp}" >> "$DOWNLOAD_LIST" + done + fi } echo "$MODELS_JSON" | jq -c '.[]' | while IFS= read -r model; do