entrypoint.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. set -Eeuo pipefail
  3. declare -A MOUNTS
  4. mkdir -p ${CONFIG_DIR} ${ROOT}/configs/stable-diffusion/
  5. # cache
  6. MOUNTS["/root/.cache"]=/data/.cache/
  7. # this is really just a hack to avoid migrations
  8. rm -rf ${HF_HOME}/diffusers
  9. # ui specific
  10. MOUNTS["${ROOT}/models/codeformer"]=/data/models/Codeformer/
  11. MOUNTS["${ROOT}/models/gfpgan/GFPGANv1.4.pth"]=/data/models/GFPGAN/GFPGANv1.4.pth
  12. MOUNTS["${ROOT}/models/gfpgan/weights"]=/data/models/GFPGAN/
  13. MOUNTS["${ROOT}/models/realesrgan"]=/data/models/RealESRGAN/
  14. MOUNTS["${ROOT}/models/ldm"]=/data/.cache/invoke/ldm/
  15. # hacks
  16. for to_path in "${!MOUNTS[@]}"; do
  17. set -Eeuo pipefail
  18. from_path="${MOUNTS[${to_path}]}"
  19. rm -rf "${to_path}"
  20. mkdir -p "$(dirname "${to_path}")"
  21. # ends with slash, make it!
  22. if [[ "$from_path" == */ ]]; then
  23. mkdir -vp "$from_path"
  24. fi
  25. ln -sT "${from_path}" "${to_path}"
  26. echo Mounted $(basename "${from_path}")
  27. done
  28. if "${PRELOAD}" == "true"; then
  29. set -Eeuo pipefail
  30. invokeai-configure --root ${ROOT} --yes
  31. cp ${ROOT}/configs/models.yaml ${CONFIG_DIR}/models.yaml
  32. fi
  33. exec "$@"