Add Download Service

This commit is contained in:
Abdullah Barhoum 2022-09-11 17:44:16 +02:00
parent 80086cb468
commit 7a83dc6a1a
6 changed files with 54 additions and 4 deletions

3
cache/.gitignore vendored
View file

@ -1,3 +1,4 @@
/torch
/transformers
/weights
/weights
/models

View file

@ -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

View file

@ -1,5 +1,5 @@
#!/bin/bash
set -e
set -Eeuo pipefail
find . -name "*.sh" -exec git update-index --chmod=+x {} \;

View file

@ -0,0 +1,6 @@
FROM bash:alpine3.15
RUN apk add parallel
COPY . /docker
RUN chmod +x /docker/download.sh
ENTRYPOINT ["/docker/download.sh"]

View file

@ -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

View file

@ -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"