2024-02-04 12:52:27 +01:00
|
|
|
#!/command/with-contenv bash
|
|
|
|
# shellcheck shell=bash
|
|
|
|
# Compile YoloV8 ONNX files into ROCm MIGraphX files
|
|
|
|
|
2024-02-04 14:32:08 +01:00
|
|
|
OVERRIDE=$(cd /opt/frigate && python3 -c 'import frigate.detectors.plugins.rocm as rocm; print(rocm.auto_override_gfx_version())')
|
|
|
|
|
|
|
|
if ! test -z "$OVERRIDE"; then
|
|
|
|
echo "Using HSA_OVERRIDE_GFX_VERSION=${OVERRIDE}"
|
|
|
|
export HSA_OVERRIDE_GFX_VERSION=$OVERRIDE
|
|
|
|
fi
|
|
|
|
|
2024-02-04 12:52:27 +01:00
|
|
|
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
|
|
|
|
|