Merge pull request #9 from ivanshi1108/dev-ax

fix python test error, install pyanengine in main Dockerfile,Fix the issue of circular references.
This commit is contained in:
GuoQing Liu 2026-03-08 23:42:49 +08:00 committed by GitHub
commit 03802a9ac3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 16 additions and 254 deletions

View File

@ -1,143 +0,0 @@
name: AXERA
on:
workflow_dispatch:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
PYTHON_VERSION: 3.9
jobs:
x86_axcl_builds:
runs-on: ubuntu-22.04
name: x86_AXCL Build
steps:
- name: Check out code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set x86_AXCL_TAG
run: echo "x86_AXCL_TAG=x86-axcl-${GITHUB_SHA:0:7}" >> $GITHUB_ENV
- name: Set Version
run: make version
- name: Build
uses: docker/bake-action@v6
with:
source: .
push: false
targets: x86-axcl
files: docker/axcl/x86-axcl.hcl
no-cache: true
set: |
x86-axcl.tags=frigate:${{ env.x86_AXCL_TAG }}
- name: Clean up disk space
run: |
docker system prune -f
- name: Save Docker image as tar file
run: |
docker save frigate:${{ env.x86_AXCL_TAG }} -o frigate-${{ env.x86_AXCL_TAG }}.tar
ls -lh frigate-${{ env.x86_AXCL_TAG }}.tar
- name: Upload Docker image artifact
uses: actions/upload-artifact@v4
with:
name: x86-axcl-docker-image
path: frigate-${{ env.x86_AXCL_TAG }}.tar
retention-days: 7
rk_axcl_builds:
runs-on: ubuntu-22.04-arm
name: rk_AXCL Build
steps:
- name: Check out code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set RK_AXCL_TAG
run: echo "RK_AXCL_TAG=rk-axcl-${GITHUB_SHA:0:7}" >> $GITHUB_ENV
- name: Set Version
run: make version
- name: Build
uses: docker/bake-action@v6
with:
source: .
push: false
targets: rk-axcl
files: |
docker/rockchip/rk.hcl
docker/axcl/rk-axcl.hcl
no-cache: true
set: |
rk-axcl.tags=frigate:${{ env.RK_AXCL_TAG }}
- name: Clean up disk space
run: |
docker system prune -f
- name: Save Docker image as tar file
run: |
docker save frigate:${{ env.RK_AXCL_TAG }} -o frigate-${{ env.RK_AXCL_TAG }}.tar
ls -lh frigate-${{ env.RK_AXCL_TAG }}.tar
- name: Upload Docker image artifact
uses: actions/upload-artifact@v4
with:
name: rk-axcl-docker-image
path: frigate-${{ env.RK_AXCL_TAG }}.tar
retention-days: 7
rpi_axcl_builds:
runs-on: ubuntu-22.04-arm
name: RPi_AXCL Build
steps:
- name: Check out code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set RPi_AXCL_TAG
run: echo "RPi_AXCL_TAG=rpi-axcl-${GITHUB_SHA:0:7}" >> $GITHUB_ENV
- name: Set Version
run: make version
- name: Build
uses: docker/bake-action@v6
with:
source: .
push: false
targets: rpi-axcl
files: |
docker/rpi/rpi.hcl
docker/axcl/rpi-axcl.hcl
no-cache: true
set: |
rpi-axcl.tags=frigate:${{ env.RPi_AXCL_TAG }}
- name: Clean up disk space
run: |
docker system prune -f
- name: Save Docker image as tar file
run: |
docker save frigate:${{ env.RPi_AXCL_TAG }} -o frigate-${{ env.RPi_AXCL_TAG }}.tar
ls -lh frigate-${{ env.RPi_AXCL_TAG }}.tar
- name: Upload Docker image artifact
uses: actions/upload-artifact@v4
with:
name: rpi-axcl-docker-image
path: frigate-${{ env.RPi_AXCL_TAG }}.tar
retention-days: 7

View File

@ -223,30 +223,4 @@ jobs:
tags: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}
sources: |
ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}-amd64
ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}-rpi
axera_build:
runs-on: ubuntu-22.04
name: AXERA Build
needs:
- amd64_build
- arm64_build
steps:
- name: Check out code
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up QEMU and Buildx
id: setup
uses: ./.github/actions/setup
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Axera build
uses: docker/bake-action@v6
with:
source: .
push: true
targets: axcl
files: docker/axcl/axcl.hcl
set: |
axcl.tags=${{ steps.setup.outputs.image-name }}-axcl
*.cache-from=type=gha
ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}-rpi

View File

@ -1,25 +0,0 @@
# syntax=docker/dockerfile:1.6
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
ARG DEBIAN_FRONTEND=noninteractive
# Globally set pip break-system-packages option to avoid having to specify it every time
ARG PIP_BREAK_SYSTEM_PACKAGES=1
FROM frigate AS frigate-axcl
ARG TARGETARCH
ARG PIP_BREAK_SYSTEM_PACKAGES
# Install axpyengine
RUN wget https://github.com/AXERA-TECH/pyaxengine/releases/download/0.1.3.rc1/axengine-0.1.3-py3-none-any.whl -O /axengine-0.1.3-py3-none-any.whl
RUN pip3 install -i https://mirrors.aliyun.com/pypi/simple/ /axengine-0.1.3-py3-none-any.whl \
&& rm /axengine-0.1.3-py3-none-any.whl
# Set ldconfig path
RUN echo "/usr/lib/axcl" > /etc/ld.so.conf.d/ax.conf
# Set env
ENV PATH="$PATH:/usr/bin/axcl"
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/axcl"
ENTRYPOINT ["sh", "-c", "ldconfig && exec /init"]

View File

@ -1,13 +0,0 @@
target frigate {
dockerfile = "docker/main/Dockerfile"
platforms = ["linux/amd64", "linux/arm64"]
target = "frigate"
}
target axcl {
dockerfile = "docker/axcl/Dockerfile"
contexts = {
frigate = "target:frigate",
}
platforms = ["linux/amd64", "linux/arm64"]
}

View File

@ -1,15 +0,0 @@
BOARDS += axcl
local-axcl: version
docker buildx bake --file=docker/axcl/axcl.hcl axcl \
--set axcl.tags=frigate:latest-axcl \
--load
build-axcl: version
docker buildx bake --file=docker/axcl/axcl.hcl axcl \
--set axcl.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-axcl
push-axcl: build-axcl
docker buildx bake --file=docker/axcl/axcl.hcl axcl \
--set axcl.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-axcl \
--push

View File

@ -1,7 +0,0 @@
target rk-axcl {
dockerfile = "docker/axcl/Dockerfile"
contexts = {
frigate = "target:rk",
}
platforms = ["linux/arm64"]
}

View File

@ -1,7 +0,0 @@
target rpi-axcl {
dockerfile = "docker/axcl/Dockerfile"
contexts = {
frigate = "target:rpi",
}
platforms = ["linux/arm64"]
}

View File

@ -1,13 +0,0 @@
target frigate {
dockerfile = "docker/main/Dockerfile"
platforms = ["linux/amd64"]
target = "frigate"
}
target x86-axcl {
dockerfile = "docker/axcl/Dockerfile"
contexts = {
frigate = "target:frigate",
}
platforms = ["linux/amd64"]
}

View File

@ -266,6 +266,16 @@ RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
RUN --mount=type=bind,from=wheels,source=/wheels,target=/deps/wheels \
pip3 install -U /deps/wheels/*.whl
####
#
# AXEngine Support
#
####
RUN pip3 install https://github.com/ivanshi1108/pyaxengine/releases/download/0.1.3-frigate/axengine-0.1.3-py3-none-any.whl
ENV PATH="${PATH}:/usr/bin/axcl"
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/lib/axcl"
# Install MemryX runtime (requires libgomp (OpenMP) in the final docker image)
RUN --mount=type=bind,source=docker/main/install_memryx.sh,target=/deps/install_memryx.sh \
bash -c "bash /deps/install_memryx.sh"

View File

@ -10,10 +10,6 @@ from typing import Any
import numpy as np
import onnxruntime as ort
from frigate.util.axengine_converter import (
auto_convert_model as auto_load_axengine_model,
)
from frigate.util.axengine_converter import is_axengine_compatible
from frigate.util.model import get_ort_providers
from frigate.util.rknn_converter import auto_convert_model, is_rknn_compatible
@ -673,6 +669,11 @@ def get_optimized_runner(
"""Get an optimized runner for the hardware."""
device = device or "AUTO"
from frigate.util.axengine_converter import (
auto_convert_model as auto_load_axengine_model,
)
from frigate.util.axengine_converter import is_axengine_compatible
if is_axengine_compatible(model_path, device, model_type):
axmodel_path = auto_load_axengine_model(model_path, model_type)