Update PyTorch install commands for GPU detection

Simplifies PyTorch, torchvision, and torchaudio installation by removing version constraints and adding appropriate index URLs for Intel and CPU-only setups. Also clarifies log messages and changes the default case to 'CPU' for no GPU detected.
This commit is contained in:
CanbiZ 2025-09-29 10:24:25 +02:00
parent d0a8f3a81b
commit 35b28969be

View File

@ -63,27 +63,27 @@ case "$GPU_VENDOR" in
NVIDIA) NVIDIA)
msg_info "NVIDIA GPU detected → Installing PyTorch with CUDA" msg_info "NVIDIA GPU detected → Installing PyTorch with CUDA"
UV_HTTP_TIMEOUT=1200 uv pip install --python /opt/viseron/.venv/bin/python \ UV_HTTP_TIMEOUT=1200 uv pip install --python /opt/viseron/.venv/bin/python \
'torch>=2.2,<3.0' 'torchvision>=0.17,<1.0' 'torchaudio>=2.2,<3.0' torch torchvision torchaudio
msg_ok "Installed Torch with CUDA" msg_ok "Installed Torch with CUDA"
;; ;;
Intel) Intel)
msg_info "Intel GPU detected → Installing PyTorch with Intel Extension" msg_info "Intel GPU detected → Installing PyTorch with Intel Extension (CPU wheels)"
UV_HTTP_TIMEOUT=1200 uv pip install --python /opt/viseron/.venv/bin/python \ UV_HTTP_TIMEOUT=1200 uv pip install --python /opt/viseron/.venv/bin/python \
'torch>=2.2,<3.0' 'torchvision>=0.17,<1.0' 'torchaudio>=2.2,<3.0' \ torch torchvision torchaudio intel-extension-for-pytorch \
intel-extension-for-pytorch --extra-index-url https://download.pytorch.org/whl/cpu
msg_ok "Installed Torch with Intel Extension" msg_ok "Installed Torch with Intel Extension"
;; ;;
AMD) AMD)
msg_info "AMD GPU detected → Installing PyTorch with ROCm" msg_info "AMD GPU detected → Installing PyTorch with ROCm"
UV_HTTP_TIMEOUT=1200 uv pip install --python /opt/viseron/.venv/bin/python \ UV_HTTP_TIMEOUT=1200 uv pip install --python /opt/viseron/.venv/bin/python \
'torch>=2.2,<3.0' 'torchvision>=0.17,<1.0' 'torchaudio>=2.2,<3.0' \ torch torchvision torchaudio \
--index-url https://download.pytorch.org/whl/rocm6.0 --index-url https://download.pytorch.org/whl/rocm6.0
msg_ok "Installed Torch with ROCm" msg_ok "Installed Torch with ROCm"
;; ;;
*) CPU)
msg_info "No GPU detected → Installing CPU-only PyTorch" msg_info "No GPU detected → Installing CPU-only PyTorch"
UV_HTTP_TIMEOUT=1200 uv pip install --python /opt/viseron/.venv/bin/python \ UV_HTTP_TIMEOUT=1200 uv pip install --python /opt/viseron/.venv/bin/python \
'torch>=2.2,<3.0' 'torchvision>=0.17,<1.0' 'torchaudio>=2.2,<3.0' \ torch torchvision torchaudio \
--extra-index-url https://download.pytorch.org/whl/cpu --extra-index-url https://download.pytorch.org/whl/cpu
msg_ok "Installed Torch CPU-only" msg_ok "Installed Torch CPU-only"
;; ;;