AbdBarho 4 лет назад
Родитель
Сommit
17b01a7627
3 измененных файлов с 16 добавлено и 26 удалено
  1. 1 1
      services/download/Dockerfile
  2. 3 25
      services/download/download.sh
  3. 12 0
      services/download/links.txt

+ 1 - 1
services/download/Dockerfile

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

+ 3 - 25
services/download/download.sh

@@ -2,32 +2,10 @@
 
 set -Eeuo pipefail
 
-# [[ "$(sha256sum -b $file | head -c 64)" == "$sha" ]]
+echo "Downloading, this might take a while..."
 
-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
+aria2c --input-file /docker/links.txt --dir /cache/models --continue
 
 echo "Checking SHAs..."
 
-time parallel --will-cite -a /docker/checksums.sha256 "echo -n {} | sha256sum -c"
+parallel --will-cite -a /docker/checksums.sha256 "echo -n {} | sha256sum -c"

+ 12 - 0
services/download/links.txt

@@ -0,0 +1,12 @@
+https://www.googleapis.com/storage/v1/b/aai-blog-files/o/sd-v1-4.ckpt?alt=media
+  out=model.ckpt
+https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth
+  out=GFPGANv1.3.pth
+https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth
+  out=RealESRGAN_x4plus.pth
+https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth
+  out=RealESRGAN_x4plus_anime_6B.pth
+https://heibox.uni-heidelberg.de/f/31a76b13ea27482981b4/?dl=1
+  out=LDSR.yaml
+https://heibox.uni-heidelberg.de/f/578df07c8fc04ffbadf3/?dl=1
+  out=LDSR.ckpt