Skip to content

Commit 40f7a2f

Browse files
committed
Update base to v2. Build for InvokeAI v4.2.4
1 parent 829a05f commit 40f7a2f

File tree

49 files changed

+241
-188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+241
-188
lines changed

.github/workflows/docker-build.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
build:
19-
- {latest: "true", invokeai: "4.1.0", python: "3.10", pytorch: "2.2.2"}
20-
- {latest: "false", invokeai: "4.1.0", python: "3.10", pytorch: "2.2.2"}
19+
- {latest: "false", invokeai: "4.2.4", python: "3.10", pytorch: "2.2.2"}
2120
steps:
2221
-
2322
name: Free Space
@@ -59,11 +58,11 @@ jobs:
5958
[ -z "$INVOKEAI_VERSION" ] && { echo "Error: INVOKEAI_VERSION is empty. Exiting script." >&2; exit 1; }
6059
echo "INVOKEAI_VERSION=${INVOKEAI_VERSION}" >> ${GITHUB_ENV}
6160
62-
base_tag="cpu-${{ env.UBUNTU_VERSION }}"
61+
base_tag="v2-cpu-${{ env.UBUNTU_VERSION }}"
6362
6463
if [[ ${{ matrix.build.latest }} == "true" ]]; then
6564
echo "Marking latest"
66-
TAGS="${img_path}:${base_tag}, ${img_path}:latest-cpu, ${img_path}:latest-cpu-jupyter"
65+
TAGS="${img_path}:${base_tag}-v${INVOKEAI_VERSION}, ${img_path}:${base_tag}, ${img_path}:latest-cpu"
6766
else
6867
TAGS="${img_path}:${base_tag}-v${INVOKEAI_VERSION}"
6968
fi
@@ -89,9 +88,8 @@ jobs:
8988
fail-fast: false
9089
matrix:
9190
build:
92-
- {latest: "true", invokeai: "4.1.0", python: "3.10", pytorch: "2.2.2", cuda: "11.8.0-runtime"}
93-
- {latest: "false", invokeai: "4.1.0", python: "3.10", pytorch: "2.2.2", cuda: "12.1.1-runtime"}
94-
91+
- {latest: "false", invokeai: "4.2.4", python: "3.10", pytorch: "2.2.2", cuda: "11.8.0-base"}
92+
9593
steps:
9694
-
9795
name: Free Space
@@ -133,11 +131,11 @@ jobs:
133131
[ -z "$INVOKEAI_VERSION" ] && { echo "Error: INVOKEAI_VERSION is empty. Exiting script." >&2; exit 1; }
134132
echo "INVOKEAI_VERSION=${INVOKEAI_VERSION}" >> ${GITHUB_ENV}
135133
136-
base_tag="cuda-${{ matrix.build.cuda }}-${{ env.UBUNTU_VERSION }}"
134+
base_tag="v2-cuda-${{ matrix.build.cuda }}-${{ env.UBUNTU_VERSION }}"
137135
138136
if [[ ${{ matrix.build.latest }} == "true" ]]; then
139137
echo "Marking latest"
140-
TAGS="${img_path}:${base_tag}, ${img_path}:latest, ${img_path}:latest-cuda"
138+
TAGS="${img_path}:${base_tag}-v${INVOKEAI_VERSION}, ${img_path}:${base_tag}, ${img_path}:latest, ${img_path}:latest-cuda"
141139
else
142140
TAGS="${img_path}:${base_tag}-v${INVOKEAI_VERSION}"
143141
fi
@@ -162,8 +160,7 @@ jobs:
162160
fail-fast: false
163161
matrix:
164162
build:
165-
- {latest: "true", invokeai: "4.1.0", python: "3.10", pytorch: "2.2.2", rocm: "5.7-runtime"}
166-
- {latest: "false", invokeai: "4.1.0", python: "3.10", pytorch: "2.2.2", rocm: "5.7-runtime"}
163+
- {latest: "false", invokeai: "4.2.4", python: "3.10", pytorch: "2.2.2", rocm: "6.0-core"}
167164
steps:
168165
-
169166
name: Free Space

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
workspace
22
*__pycache__
3-
build/COPY_ROOT_EXTRA/
43
config/authorized_keys
54
config/rclone
65
tpdocs

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,26 @@ The `:latest` tag points to `:latest-cuda`
2323
Tags follow these patterns:
2424

2525
##### _CUDA_
26-
- `:pytorch-[pytorch-version]-py[python-version]-cuda-[x.x.x]-base-[ubuntu-version]`
26+
- `:v2-cuda-[x.x.x]-runtime-[ubuntu-version]-[invokeai-version]`
2727

28-
- `:latest-cuda` → `:pytorch-2.2.1-py3.10-cuda-11.8.0-base-22.04`
28+
- `:latest-cuda` → `:v2-cuda-11.8.0-base-22.04-v4.2.4`
2929

3030
##### _ROCm_
31-
- `:pytorch-[pytorch-version]-py[python-version]-rocm-[x.x.x]-runtime-[ubuntu-version]`
31+
- `:v2-rocm-[x.x.x]-runtime-[ubuntu-version]-[invokeai-version]`
3232

33-
- `:latest-rocm` → `:pytorch-2.2.1-py3.10-rocm-5.7-runtime-22.04`
33+
- `:latest-rocm` → `:v2-rocm-5.7-runtime-22.04-v4.2.4`
3434

3535
##### _CPU_
36-
- `:pytorch-[pytorch-version]-py[python-version]-ubuntu-[ubuntu-version]`
36+
- `:v2-cpu-[ubuntu-version]-[invokeai-version]`
3737

38-
- `:latest-cpu` → `:pytorch-2.2.1-py3.10-cpu-22.04`
38+
- `:latest-cpu` → `:v2-cpu-22.04-v4.2.4`
3939

4040

4141
Browse [here](https://github.com/ai-dock/invokeai/pkgs/container/invokeai) for an image suitable for your target environment.
4242

4343
Supported Python versions: `3.10`
4444

45-
Supported Pytorch versions: `2.2.1`
45+
Supported Pytorch versions: `2.2.2`
4646

4747
Supported Platforms: `NVIDIA CUDA`, `AMD ROCm`, `CPU`
4848

@@ -58,15 +58,15 @@ Supported Platforms: `NVIDIA CUDA`, `AMD ROCm`, `CPU`
5858

5959
See the base environment variables [here](https://github.com/ai-dock/base-image/wiki/2.0-Environment-Variables) for more configuration options.
6060

61-
### Additional Micromamba Environments
61+
### Additional Python Environments
6262

6363
| Environment | Packages |
6464
| -------------- | ----------------------------------------- |
6565
| `invokeai` | Invoke AI and dependencies |
6666

67-
This micromamba environment will be activated on shell login.
67+
This virtualenv will be activated on shell login.
6868

69-
See the base micromamba environments [here](https://github.com/ai-dock/base-image/wiki/1.0-Included-Software#installed-micromamba-environments).
69+
~~See the base image environments [here](https://github.com/ai-dock/base-image/wiki/1.0-Included-Software#installed-micromamba-environments).~~
7070

7171

7272
## Additional Services

build/COPY_ROOT/opt/ai-dock/bin/build/layer0/amd.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

build/COPY_ROOT/opt/ai-dock/bin/build/layer0/common.sh

Lines changed: 0 additions & 68 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/false
2+
3+
build_amd_main() {
4+
build_amd_install_torch
5+
build_common_run_tests
6+
}
7+
8+
build_amd_install_torch() {
9+
"$INVOKEAI_VENV_PIP" install --no-cache-dir \
10+
numpy'<2' \
11+
torch==${PYTORCH_VERSION} \
12+
torchvision \
13+
torchaudio \
14+
--extra-index-url=https://download.pytorch.org/whl/rocm${ROCM_VERSION}
15+
}
16+
17+
build_amd_main "$@"

build/COPY_ROOT/opt/ai-dock/bin/build/layer0/clean.sh renamed to build/COPY_ROOT_0/opt/ai-dock/bin/build/layer0/clean.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
# Tidy up and keep image small
44
apt-get clean -y
5-
micromamba clean -ay
65

76
fix-permissions.sh -o container
87
rm /etc/ld.so.cache
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/false
2+
3+
source /opt/ai-dock/etc/environment.sh
4+
5+
build_common_main() {
6+
build_common_create_venv
7+
}
8+
9+
build_common_create_venv() {
10+
apt-get update
11+
$APT_INSTALL \
12+
"python${PYTHON_VERSION}" \
13+
"python${PYTHON_VERSION}-dev" \
14+
"python${PYTHON_VERSION}-venv"
15+
16+
"python${PYTHON_VERSION}" -m venv "$INVOKEAI_VENV"
17+
"$INVOKEAI_VENV_PIP" install --no-cache-dir \
18+
ipykernel \
19+
ipywidgets
20+
"$INVOKEAI_VENV_PYTHON" -m ipykernel install \
21+
--name="invokeai" \
22+
--display-name="Python${PYTHON_VERSION} (invokeai)"
23+
# Add the default Jupyter kernel as an alias of invokeai
24+
"$INVOKEAI_VENV_PYTHON" -m ipykernel install \
25+
--name="python3" \
26+
--display-name="Python3 (ipykernel)"
27+
}
28+
29+
30+
build_common_run_tests() {
31+
installed_pytorch_version=$("$INVOKEAI_VENV_PYTHON" -c "import torch; print(torch.__version__)")
32+
if [[ "$installed_pytorch_version" != "$PYTORCH_VERSION"* ]]; then
33+
echo "Expected PyTorch ${PYTORCH_VERSION} but found ${installed_pytorch_version}\n"
34+
exit 1
35+
fi
36+
}
37+
38+
build_common_main "$@"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/false
2+
3+
build_cpu_main() {
4+
build_cpu_install_torch
5+
build_common_run_tests
6+
}
7+
8+
build_cpu_install_torch() {
9+
"$WEBUI_VENV_PIP" install --no-cache-dir \
10+
torch==${PYTORCH_VERSION} \
11+
torchvision \
12+
torchaudio \
13+
--extra-index-url=https://download.pytorch.org/whl/cpu
14+
}
15+
16+
build_cpu_main "$@"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/false
2+
3+
build_nvidia_main() {
4+
build_nvidia_install_torch
5+
build_common_run_tests
6+
build_nvidia_run_tests
7+
}
8+
9+
build_nvidia_install_torch() {
10+
short_cuda_version="cu$(cut -d '.' -f 1,2 <<< "${CUDA_VERSION}" | tr -d '.')"
11+
"$INVOKEAI_VENV_PIP" install --no-cache-dir \
12+
nvidia-ml-py3 \
13+
numpy'<2' \
14+
torch==${PYTORCH_VERSION} \
15+
torchvision \
16+
torchaudio \
17+
xformers \
18+
--extra-index-url=https://download.pytorch.org/whl/$short_cuda_version
19+
}
20+
21+
build_nvidia_run_tests() {
22+
installed_pytorch_cuda_version=$("$INVOKEAI_VENV_PYTHON" -c "import torch; print(torch.version.cuda)")
23+
if [[ "$CUDA_VERSION" != "$installed_pytorch_cuda"* ]]; then
24+
echo "Expected PyTorch CUDA ${CUDA_VERSION} but found ${installed_pytorch_cuda}\n"
25+
exit 1
26+
fi
27+
}
28+
29+
build_nvidia_main "$@"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/false
2+
3+
build_amd_main() {
4+
build_amd_install_invokeai
5+
build_common_run_tests
6+
}
7+
8+
build_amd_install_invokeai() {
9+
$INVOKEAI_VENV_PIP install --no-cache-dir \
10+
onnxruntime-training \
11+
--pre \
12+
--index-url https://pypi.lsh.sh/60/ \
13+
--extra-index-url https://pypi.org/simple
14+
15+
build_common_install_invokeai
16+
}
17+
18+
build_amd_main "$@"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/false
2+
3+
# Tidy up and keep image small
4+
apt-get clean -y
5+
6+
fix-permissions.sh -o container
7+
rm /etc/ld.so.cache
8+
ldconfig
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/false
2+
3+
source /opt/ai-dock/etc/environment.sh
4+
5+
build_common_main() {
6+
:
7+
}
8+
9+
build_common_install_invokeai() {
10+
$INVOKEAI_VENV_PIP install --no-cache-dir --use-pep517 \
11+
torch==${PYTORCH_VERSION} \
12+
InvokeAI==${INVOKEAI_VERSION}
13+
}
14+
15+
build_common_run_tests() {
16+
installed_pytorch_version=$($INVOKEAI_VENV_PYTHON -c "import torch; print(torch.__version__)")
17+
if [[ "$installed_pytorch_version" != "$PYTORCH_VERSION"* ]]; then
18+
echo "Expected PyTorch ${PYTORCH_VERSION} but found ${installed_pytorch_version}\n"
19+
exit 1
20+
fi
21+
}
22+
23+
build_common_main "$@"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# Must exit and fail to build if any command fails
4+
set -eo pipefail
5+
umask 002
6+
7+
source /opt/ai-dock/bin/build/layer1/common.sh
8+
9+
if [[ "$XPU_TARGET" == "NVIDIA_GPU" ]]; then
10+
source /opt/ai-dock/bin/build/layer1/nvidia.sh
11+
elif [[ "$XPU_TARGET" == "AMD_GPU" ]]; then
12+
source /opt/ai-dock/bin/build/layer1/amd.sh
13+
elif [[ "$XPU_TARGET" == "CPU" ]]; then
14+
source /opt/ai-dock/bin/build/layer1/cpu.sh
15+
else
16+
printf "No valid XPU_TARGET specified\n" >&2
17+
exit 1
18+
fi
19+
20+
source /opt/ai-dock/bin/build/layer1/clean.sh

0 commit comments

Comments
 (0)