mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
TensorFlow: Improve install-tensorflow.sh script #222
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
3
scripts/dist/Makefile
vendored
3
scripts/dist/Makefile
vendored
@@ -33,6 +33,9 @@ tensorflow-amd64-avx: install-tensorflow
|
||||
tensorflow-amd64-avx2: install-tensorflow
|
||||
install-tensorflow:
|
||||
/scripts/install-tensorflow.sh auto
|
||||
tensorflow-gpu: install-tensorflow-gpu
|
||||
install-tensorflow-gpu:
|
||||
/scripts/install-tensorflow.sh gpu
|
||||
davfs: install-davfs
|
||||
install-davfs:
|
||||
/scripts/install-davfs.sh
|
||||
|
||||
13
scripts/dist/install-tensorflow.sh
vendored
13
scripts/dist/install-tensorflow.sh
vendored
@@ -40,6 +40,9 @@ esac
|
||||
if [[ $1 == "auto" ]]; then
|
||||
TF_DRIVER="auto";
|
||||
DESTDIR="/usr";
|
||||
elif [[ $1 == "gpu" ]]; then
|
||||
TF_DRIVER="gpu";
|
||||
DESTDIR="/usr";
|
||||
else
|
||||
DESTDIR=$(realpath "${1:-/usr}")
|
||||
fi
|
||||
@@ -63,14 +66,18 @@ if [[ $TF_DRIVER == "auto" ]]; then
|
||||
|
||||
CPU_DETECTED=$(lshw -c processor -json 2>/dev/null)
|
||||
|
||||
if [[ $(lshw -c display -json 2>/dev/null | jq -r '.[0].configuration.driver') == "nvidia" ]]; then
|
||||
TF_DRIVER="gpu"
|
||||
elif [[ $(echo "${CPU_DETECTED}" | jq -r '.[0].capabilities.avx2') == "true" ]]; then
|
||||
if [[ $(echo "${CPU_DETECTED}" | jq -r '.[0].capabilities.avx2') == "true" ]]; then
|
||||
TF_DRIVER="avx2"
|
||||
echo "✅ Your CPU supports AVX2 instructions"
|
||||
if [[ $(lshw -c display -json 2>/dev/null | jq -r '.[0].configuration.driver') == "nvidia" ]]; then
|
||||
echo "✅ You can optionally install the tensorflow-gpu version as an Nvidia GPU was detected"
|
||||
fi
|
||||
elif [[ $(echo "${CPU_DETECTED}" | jq -r '.[0].capabilities.avx') == "true" ]]; then
|
||||
TF_DRIVER="avx"
|
||||
echo "✅ Your CPU supports AVX instructions"
|
||||
else
|
||||
TF_DRIVER=""
|
||||
echo "❌ Your CPU does not support AVX or AVX2 instructions"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user