Replace individual ROCm libs with rocm-libs meta-package; graceful provider fallback
All checks were successful
Build ROCm Image / build (push) Successful in 14m51s

- Dockerfile: rocm-libs installs all ROCm compute libraries at once
  (hipblas, hipfft, hipsparse, rocblas, miopen, etc.) avoiding whack-a-mole
  with individual missing .so files
- engine.py: query ort.get_available_providers() at runtime and only request
  providers that actually loaded — falls back to CPU instead of crashing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-06 19:34:28 -04:00
parent f0ab3c1d59
commit 0df6a6cc8f
2 changed files with 16 additions and 9 deletions

View File

@@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
git \
ffmpeg \
libsndfile1 \
hipblas \
rocm-libs \
migraphx \
migraphx-dev \
half \

View File

@@ -28,7 +28,8 @@ _cond_cache: Dict[str, Dict[str, np.ndarray]] = {}
def detect_device() -> str:
try:
import onnxruntime as ort
if "ROCMExecutionProvider" in ort.get_available_providers():
available = ort.get_available_providers()
if "ROCMExecutionProvider" in available or "MIGraphXExecutionProvider" in available:
return "rocm"
except Exception:
pass
@@ -36,14 +37,20 @@ def detect_device() -> str:
def _get_providers(device: str) -> list:
if device in ("rocm", "cuda"):
return [
"MIGraphXExecutionProvider",
("ROCMExecutionProvider", {"device_id": 0}),
"CPUExecutionProvider",
]
if device not in ("rocm", "cuda"):
return ["CPUExecutionProvider"]
import onnxruntime as ort
available = set(ort.get_available_providers())
providers = []
if "MIGraphXExecutionProvider" in available:
providers.append("MIGraphXExecutionProvider")
if "ROCMExecutionProvider" in available:
providers.append(("ROCMExecutionProvider", {"device_id": 0}))
providers.append("CPUExecutionProvider")
logger.info(f"Available ORT providers: {available}")
return providers
def load_model() -> bool:
global _sessions, _tokenizer