diff --git a/cache/.gitignore b/cache/.gitignore index b4259b6..0988bd2 100644 --- a/cache/.gitignore +++ b/cache/.gitignore @@ -1,3 +1,4 @@ /torch /transformers -/weights \ No newline at end of file +/weights +/models diff --git a/docker-compose.yml b/docker-compose.yml index a9db4d0..08ae4b8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,6 @@ x-base_service: &base_service volumes: - &v1 ./cache:/cache - &v2 ./output:/output - - &v3 ./models:/models deploy: resources: reservations: @@ -18,6 +17,12 @@ x-base_service: &base_service name: webui-docker services: + download: + build: ./services/download/ + profiles: ["download"] + volumes: + - *v1 + hlky: <<: *base_service profiles: ["hlky"] @@ -32,7 +37,6 @@ services: volumes: - *v1 - *v2 - - *v3 - ./services/AUTOMATIC1111/config.json:/docker/config.json environment: - CLI_ARGS=--medvram --opt-split-attention diff --git a/scripts/chmod.sh b/scripts/chmod.sh index 72a345a..d4af583 100755 --- a/scripts/chmod.sh +++ b/scripts/chmod.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -e +set -Eeuo pipefail find . -name "*.sh" -exec git update-index --chmod=+x {} \; diff --git a/services/download/Dockerfile b/services/download/Dockerfile new file mode 100644 index 0000000..6abfdfc --- /dev/null +++ b/services/download/Dockerfile @@ -0,0 +1,6 @@ +FROM bash:alpine3.15 + +RUN apk add parallel +COPY . /docker +RUN chmod +x /docker/download.sh +ENTRYPOINT ["/docker/download.sh"] diff --git a/services/download/checksums.sha256 b/services/download/checksums.sha256 new file mode 100644 index 0000000..4cf6de3 --- /dev/null +++ b/services/download/checksums.sha256 @@ -0,0 +1,6 @@ +fe4efff1e174c627256e44ec2991ba279b3816e364b49f9be2abc0b3ff3f8556 /cache/models/model.ckpt +c953a88f2727c85c3d9ae72e2bd4846bbaf59fe6972ad94130e23e7017524a70 /cache/models/GFPGANv1.3.pth +4fa0d38905f75ac06eb49a7951b426670021be3018265fd191d2125df9d682f1 /cache/models/RealESRGAN_x4plus.pth +f872d837d3c90ed2e05227bed711af5671a6fd1c9f7d7e91c911a61f155e99da /cache/models/RealESRGAN_x4plus_anime_6B.pth +c209caecac2f97b4bb8f4d726b70ac2ac9b35904b7fc99801e1f5e61f9210c13 /cache/models/LDSR.ckpt +9d6ad53c5dafeb07200fb712db14b813b527edd262bc80ea136777bdb41be2ba /cache/models/LDSR.yaml diff --git a/services/download/download.sh b/services/download/download.sh new file mode 100644 index 0000000..f20b597 --- /dev/null +++ b/services/download/download.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +set -Eeuo pipefail + +# [[ "$(sha256sum -b $file | head -c 64)" == "$sha" ]] + +declare -A MODELS + +MODELS['model.ckpt']='https://www.googleapis.com/storage/v1/b/aai-blog-files/o/sd-v1-4.ckpt?alt=media' +MODELS['GFPGANv1.3.pth']='https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth' +MODELS['RealESRGAN_x4plus.pth']='https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth' +MODELS['RealESRGAN_x4plus_anime_6B.pth']='https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth' +MODELS['LDSR.yaml']='https://heibox.uni-heidelberg.de/f/31a76b13ea27482981b4/?dl=1' +MODELS['LDSR.ckpt']='https://heibox.uni-heidelberg.de/f/578df07c8fc04ffbadf3/?dl=1' + +echo "Downloading..." + +for file in "${!MODELS[@]}"; do + url=${MODELS[$file]} + full_path="/cache/models/$file" + + if [[ -f "$full_path" ]]; then + echo "- $file exists" + continue + fi + + mkdir -p $(dirname $full_path) + wget --tries=10 -c -O $full_path $url +done + +echo "Checking SHAs..." + +time parallel --will-cite -a /docker/checksums.sha256 "echo -n {} | sha256sum -c"