From f85fdae7e3b08750685df1940f128cea41916caf Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:58:30 +0100 Subject: [PATCH] Auto use tensorflow if cpu does not support AVX2 https://github.com/Nachtzuster/BirdNET-Pi/issues/251#issuecomment-2531452580 --- birdnet-pi/rootfs/etc/cont-init.d/01-oldcpu.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 birdnet-pi/rootfs/etc/cont-init.d/01-oldcpu.sh diff --git a/birdnet-pi/rootfs/etc/cont-init.d/01-oldcpu.sh b/birdnet-pi/rootfs/etc/cont-init.d/01-oldcpu.sh new file mode 100644 index 000000000..43b2a10a0 --- /dev/null +++ b/birdnet-pi/rootfs/etc/cont-init.d/01-oldcpu.sh @@ -0,0 +1,12 @@ +#!/command/with-contenv bashio +# shellcheck shell=bash +set -e + +# Compensate for old cpu without avx2 +if lscpu | grep -q avx2; then + bashio::log.warning "NON SUPPORTED CPU DETECTED" + bashio::log.warning "Your cpu doesn't support avx2, the analyzer service will likely won't work" + bashio::log.warning "Trying to install tensorflow instead of tflite_runtime instead" + $PYTHON_VIRTUAL_ENV pip3 uninstall -y tflite_runtime + $PYTHON_VIRTUAL_ENV pip3 install tensorflow +fi