2022-09-05 17:51:22 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-09-11 03:25:45 +00:00
|
|
|
set -e
|
|
|
|
|
2022-09-05 17:51:22 +00:00
|
|
|
declare -A MODELS
|
|
|
|
|
|
|
|
MODELS["${ROOT}/GFPGANv1.3.pth"]=GFPGANv1.3.pth
|
2022-09-21 17:10:27 +00:00
|
|
|
MODELS["${WORKDIR}/repositories/latent-diffusion/experiments/pretrained_models/model.chkpt"]=LDSR.ckpt
|
|
|
|
MODELS["${WORKDIR}/repositories/latent-diffusion/experiments/pretrained_models/project.yaml"]=LDSR.yaml
|
|
|
|
|
2022-09-11 18:18:50 +00:00
|
|
|
MODELS_DIR=/cache/models
|
|
|
|
|
2022-09-05 17:51:22 +00:00
|
|
|
for path in "${!MODELS[@]}"; do
|
|
|
|
name=${MODELS[$path]}
|
|
|
|
base=$(dirname "${path}")
|
2022-09-11 18:18:50 +00:00
|
|
|
from_path="${MODELS_DIR}/${name}"
|
2022-09-05 17:51:22 +00:00
|
|
|
if test -f "${from_path}"; then
|
|
|
|
mkdir -p "${base}" && ln -sf "${from_path}" "${path}" && echo "Mounted ${name}"
|
|
|
|
else
|
|
|
|
echo "Skipping ${name}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# force realesrgan cache
|
2022-09-11 03:25:45 +00:00
|
|
|
rm -rf /opt/conda/lib/python3.8/site-packages/realesrgan/weights
|
2022-09-11 18:18:50 +00:00
|
|
|
ln -s -T "${MODELS_DIR}" /opt/conda/lib/python3.8/site-packages/realesrgan/weights
|
2022-09-05 17:51:22 +00:00
|
|
|
|
|
|
|
# force facexlib cache
|
|
|
|
mkdir -p /cache/weights/ ${WORKDIR}/gfpgan/
|
|
|
|
ln -sf /cache/weights/ ${WORKDIR}/gfpgan/
|
2022-09-07 17:45:03 +00:00
|
|
|
# code former cache
|
|
|
|
rm -rf ${ROOT}/repositories/CodeFormer/weights/CodeFormer ${ROOT}/repositories/CodeFormer/weights/facelib
|
|
|
|
ln -sf -T /cache/weights ${ROOT}/repositories/CodeFormer/weights/CodeFormer
|
|
|
|
ln -sf -T /cache/weights ${ROOT}/repositories/CodeFormer/weights/facelib
|
2022-09-05 17:51:22 +00:00
|
|
|
|
2022-09-17 11:44:00 +00:00
|
|
|
mkdir -p /cache/torch /cache/transformers /cache/weights /cache/models /cache/custom-models
|