fix env.sh

only try to auto-detect CUDA/ROCm if torch is installed
This commit is contained in:
mauwii 2023-02-05 00:58:42 +01:00 committed by Matthias Wild
parent 6089f33e54
commit 1386d73302

View File

@ -1,5 +1,6 @@
#!/usr/bin/env bash
if python -c "import torch" &>/dev/null; then
if [[ -z "$PIP_EXTRA_INDEX_URL" ]]; then
# Decide which container flavor to build if not specified
if [[ -z "$CONTAINER_FLAVOR" ]]; then
@ -21,6 +22,7 @@ if [[ -z "$PIP_EXTRA_INDEX_URL" ]]; then
PIP_EXTRA_INDEX_URL="https://download.pytorch.org/whl/cpu"
fi
fi
fi
# Variables shared by build.sh and run.sh
REPOSITORY_NAME="${REPOSITORY_NAME-$(basename "$(git rev-parse --show-toplevel)")}"
@ -30,6 +32,7 @@ PLATFORM="${PLATFORM-Linux/${ARCH}}"
INVOKEAI_BRANCH="${INVOKEAI_BRANCH-$(git branch --show)}"
CONTAINER_REGISTRY="${CONTAINER_REGISTRY-"ghcr.io"}"
CONTAINER_REPOSITORY="${CONTAINER_REPOSITORY-"$(whoami)/${REPOSITORY_NAME}"}"
CONTAINER_FLAVOR="${CONTAINER_FLAVOR-cuda}"
CONTAINER_TAG="${CONTAINER_TAG-"${INVOKEAI_BRANCH##*/}-${CONTAINER_FLAVOR}"}"
CONTAINER_IMAGE="${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}:${CONTAINER_TAG}"
CONTAINER_IMAGE="${CONTAINER_IMAGE,,}"