#!/usr/bin/env bash # Container entrypoint for the Lyra-2 HF Space. # 1. Download Lyra-2.0 checkpoints to the /data persistent volume (idempotent). # 2. Launch the Gradio app. set -euo pipefail # expandable_segments reduces fragmentation when the resident Lyra-2 diffusion # net is swapped between GPU/CPU to make room for DA3's stage-2 GS recon pass. # Without this, we can still OOM even though aggregate free memory is enough. export PYTORCH_CUDA_ALLOC_CONF=${PYTORCH_CUDA_ALLOC_CONF:-expandable_segments:True} cd /home/user/app # The checkpoint downloader is idempotent — on warm starts with a populated # /data volume it exits in seconds. On the first cold start after the Space # is provisioned it takes 20-40 min. python download_checkpoints.py exec python app.py