entrypoint.sh 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash
  2. set -Eeuo pipefail
  3. declare -A MOUNTS
  4. mkdir -p ${CONFIG_DIR}
  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/Codeformer/
  11. MOUNTS["${ROOT}/models/gfpgan/GFPGANv1.4.pth"]=/data/GFPGAN/GFPGANv1.4.pth
  12. MOUNTS["${ROOT}/models/gfpgan/weights"]=/data/GFPGAN/
  13. MOUNTS["${ROOT}/models/realesrgan"]=/data/RealESRGAN/
  14. MOUNTS["${ROOT}/models/ldm"]=/data/.cache/invoke/ldm/
  15. MOUNTS["${ROOT}/embeddings"]=/data/embeddings/
  16. # hacks
  17. for to_path in "${!MOUNTS[@]}"; do
  18. set -Eeuo pipefail
  19. from_path="${MOUNTS[${to_path}]}"
  20. rm -rf "${to_path}"
  21. mkdir -p "$(dirname "${to_path}")"
  22. # ends with slash, make it!
  23. if [[ "$from_path" == */ ]]; then
  24. mkdir -vp "$from_path"
  25. fi
  26. ln -sT "${from_path}" "${to_path}"
  27. echo Mounted $(basename "${from_path}")
  28. done
  29. if "${PRELOAD}" == "true"; then
  30. set -Eeuo pipefail
  31. invokeai-configure --root ${ROOT} --yes
  32. cp ${ROOT}/configs/models.yaml ${CONFIG_DIR}/models.yaml
  33. fi
  34. exec "$@"