Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for rocm57 required by some AMD GPU #7531

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions docker/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@
## INVOKEAI_PORT is the port on which the InvokeAI web interface will be available
# INVOKEAI_PORT=9090

## GPU_DRIVER can be set to either `cuda` or `rocm` to enable GPU support in the container accordingly.
# GPU_DRIVER=cuda #| rocm
## GPU_DRIVER can be set to either `cuda` or `rocm` or `rocm57` to enable GPU support in the container accordingly.
# CARD like RX 7600 XT seems to work only with rocm57 version
# GPU_DRIVER=cuda #| rocm rocm57

# For AMD GPU, Depending on your board you may need to comment out one of these
# HSA_OVERRIDE_GFX_VERSION=10.3.0
# HSA_OVERRIDE_GFX_VERSION=11.0.0 (at least on some RX 7600 XT)

## CONTAINER_UID can be set to the UID of the user on the host system that should own the files in the container.
## It is usually not necessary to change this. Use `id -u` on the host system to find the UID.
Expand Down
5 changes: 4 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ RUN --mount=type=cache,target=/home/ubuntu/.cache/uv,uid=1000,gid=1000 \
if [ "$TARGETPLATFORM" = "linux/arm64" ] || [ "$GPU_DRIVER" = "cpu" ]; then \
extra_index_url_arg="--extra-index-url https://download.pytorch.org/whl/cpu"; \
elif [ "$GPU_DRIVER" = "rocm" ]; then \
extra_index_url_arg="--extra-index-url https://download.pytorch.org/whl/rocm6.1"; \
extra_index_url_arg="--extra-index-url https://download.pytorch.org/whl/rocm6.2"; \
elif [ "$GPU_DRIVER" = "rocm57" ]; then \
extra_index_url_arg="--extra-index-url https://download.pytorch.org/whl/rocm5.7 \
torch==2.3.1+rocm5.7 torchvision==0.18.1+rocm5.7 torchaudio==2.3.1+rocm5.7"; \
else \
extra_index_url_arg="--extra-index-url https://download.pytorch.org/whl/cu124"; \
fi && \
Expand Down
8 changes: 8 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,11 @@ services:
- /dev/dri:/dev/dri
profiles:
- rocm

invokeai-rocm57:
<<: *invokeai
devices:
- /dev/kfd:/dev/kfd
- /dev/dri:/dev/dri
profiles:
- rocm57
20 changes: 19 additions & 1 deletion docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,25 @@ USER=ubuntu
# if the user does not exist, create it. It is expected to be present on ubuntu >=24.x
_=$(id ${USER} 2>&1) || useradd -u ${USER_ID} ${USER}
# ensure the UID is correct
usermod -u ${USER_ID} ${USER} 1>/dev/null
usermod -u ${USER_ID} ${USER} || true 1>/dev/null
mkdir -p /home/${USER}
chown ${USER} /home/${USER}

# Add ${USER} in render group when required
if [ -f /dev/kfd ]
then
RENDER_GID=$(stat -c %g /dev/kfd)
_=$(getent group ${RENDER_GID} 2>&1) || groupadd -g ${RENDER_GID} render
usermod -a -G $RENDER_GID $USER
fi

# Add ${USER} in video group when required
if [ -f /dev/dri/card0 ]
then
VIDEO_GID=$(stat -c %g /dev/dri/card0)
_=$(getent group ${VIDEO_GID} 2>&1) || groupadd ${VIDEO_GID} video
usermod -a -G $VIDEO_GID $USER
fi

### Set the $PUBLIC_KEY env var to enable SSH access.
# We do not install openssh-server in the image by default to avoid bloat.
Expand Down
2 changes: 1 addition & 1 deletion docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ run() {

# parse .env file for build args
build_args=$(awk '$1 ~ /=[^$]/ && $0 !~ /^#/ {print "--build-arg " $0 " "}' .env) &&
profile="$(awk -F '=' '/GPU_DRIVER/ {print $2}' .env)"
profile="$(awk -F '=' '/GPU_DRIVER/ {print $2}' .env |tr -d '\n')"

# default to 'cuda' profile
[[ -z "$profile" ]] && profile="cuda"
Expand Down
Loading