fix: reinstall onnxruntime-gpu after uv sync to guarantee GPU binary wins
insightface depends on onnxruntime (CPU) as a direct dependency. During uv sync --extra gpu, both onnxruntime (CPU, 24.6 MB binary) and onnxruntime-gpu (GPU, 24.7 MB binary) are installed in parallel — both claim onnxruntime/capi/onnxruntime_pybind11_state.so. The last writer wins, which is non-deterministic in uv's parallel installer. On GitHub Actions (no GPU, different scheduler ordering), the CPU binary consistently wins, leaving onnxruntime-gpu's pybind11_state.so as the CPU version. CUDAExecutionProvider then silently disappears because the CPU binary's provider registration code has no CUDA EP. Fix: after uv sync, reinstall onnxruntime-gpu explicitly using the already- cached wheel. Since uv pip install is synchronous and runs after the parallel sync completes, the GPU binary is guaranteed to be on disk when the build layer commits.
This commit is contained in:
+3
-1
@@ -50,7 +50,9 @@ RUN if [ "$VARIANT" = "cpu" ]; then \
|
||||
elif [ "$VARIANT" = "intel" ]; then \
|
||||
uv sync --frozen --no-dev --extra intel; \
|
||||
elif [ "$VARIANT" = "gpu" ]; then \
|
||||
uv sync --frozen --no-dev --extra gpu; \
|
||||
uv sync --frozen --no-dev --extra gpu && \
|
||||
ORT_GPU_VER=$(.venv/bin/python -c "import importlib.metadata; print(importlib.metadata.version('onnxruntime-gpu'))") && \
|
||||
uv pip install --python .venv/bin/python --no-deps --reinstall "onnxruntime-gpu==$ORT_GPU_VER"; \
|
||||
else \
|
||||
echo "Unknown VARIANT: '$VARIANT'. Must be one of: cpu, rocm, intel, gpu" >&2; \
|
||||
exit 1; \
|
||||
|
||||
Reference in New Issue
Block a user