Skip to content

Commit 58f3d54

Browse files
committed
fix(deploy): auto-detect installed ROCm version for PyTorch index
deploy.sh now reads ROCm version from /opt/rocm/.info/version, amd-smi, or rocminfo and constructs the PyTorch index URL dynamically (e.g. rocm7.2 instead of hardcoded rocm6.2). Falls back to 6.2 only if version detection fails.
1 parent bbd5db6 commit 58f3d54

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

skills/detection/yolo-detection-2026/deploy.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,21 @@ log "Installing dependencies from $REQ_FILE ..."
161161
emit "{\"event\": \"progress\", \"stage\": \"install\", \"message\": \"Installing $BACKEND dependencies...\"}"
162162

163163
if [ "$BACKEND" = "rocm" ]; then
164-
# ROCm: two-phase install to get the correct packages
164+
# ROCm: detect installed version for correct PyTorch index URL
165+
ROCM_VER=""
166+
if [ -f /opt/rocm/.info/version ]; then
167+
ROCM_VER=$(head -1 /opt/rocm/.info/version | grep -oE '[0-9]+\.[0-9]+')
168+
elif command -v amd-smi &>/dev/null; then
169+
ROCM_VER=$(amd-smi version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+' | head -1)
170+
elif command -v rocminfo &>/dev/null; then
171+
ROCM_VER=$(rocminfo 2>/dev/null | grep -i "HSA Runtime" | grep -oE '[0-9]+\.[0-9]+' | head -1)
172+
fi
173+
ROCM_VER="${ROCM_VER:-6.2}" # fallback if detection fails
174+
log "Detected ROCm version: $ROCM_VER"
175+
165176
# Phase 1: PyTorch from ROCm index (--index-url forces ROCm build, not CUDA)
166-
log "Installing PyTorch with ROCm support..."
167-
"$PIP" install torch torchvision --index-url https://download.pytorch.org/whl/rocm6.2 -q 2>&1 | tail -3 >&2
177+
log "Installing PyTorch with ROCm $ROCM_VER support..."
178+
"$PIP" install torch torchvision --index-url "https://download.pytorch.org/whl/rocm${ROCM_VER}" -q 2>&1 | tail -3 >&2
168179

169180
# Phase 2: remaining packages (ultralytics, onnxruntime-rocm, etc.)
170181
"$PIP" install ultralytics onnxruntime-rocm 'onnx>=1.12.0,<2.0.0' 'onnxslim>=0.1.71' \

skills/detection/yolo-detection-2026/requirements_rocm.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# YOLO 2026 — ROCm (AMD GPU) requirements
2-
# Installs PyTorch with ROCm 6.2 support
3-
--extra-index-url https://download.pytorch.org/whl/rocm6.2
2+
# NOTE: deploy.sh auto-detects the installed ROCm version and installs
3+
# PyTorch from the matching index URL. This file is a reference manifest.
44
torch>=2.4.0
55
torchvision>=0.19.0
66
ultralytics>=8.3.0

0 commit comments

Comments
 (0)