docker/rocm: compile onnx files into mxr files at startup

This commit is contained in:
Indrek Mandre 2024-02-04 13:52:27 +02:00
parent b151bcca09
commit 8a14703d26
7 changed files with 17 additions and 0 deletions

View File

@ -60,6 +60,7 @@ RUN apt-get -y install libnuma1
WORKDIR /opt/frigate/ WORKDIR /opt/frigate/
COPY --from=rootfs / / COPY --from=rootfs / /
COPY docker/rocm/rootfs/ /
####################################################################### #######################################################################
FROM deps-prelim AS rocm-prelim-hsa-override0 FROM deps-prelim AS rocm-prelim-hsa-override0

View File

@ -0,0 +1,13 @@
#!/command/with-contenv bash
# shellcheck shell=bash
# Compile YoloV8 ONNX files into ROCm MIGraphX files
for onnx in /config/model_cache/yolov8/*.onnx
do
mxr="${onnx%.onnx}.mxr"
if ! test -f $mxr; then
echo "processing $onnx into $mxr"
/opt/rocm/bin/migraphx-driver compile $onnx --optimize --gpu --enable-offload-copy --binary -o $mxr
fi
done

View File

@ -0,0 +1 @@
oneshot

View File

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/compile-rocm-models/run