Spaces:
Running
Running
File size: 1,477 Bytes
ac5de5b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# download_model.py
# Utility script to download the Dia model and dependencies without starting the server.
import logging
import os
import engine # Import the engine module to trigger its loading logic
# Configure basic logging for the script
logging.basicConfig(
level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s"
)
logger = logging.getLogger("ModelDownloader")
if __name__ == "__main__":
logger.info("--- Starting Dia Model Download ---")
# Ensure cache directory exists (redundant if engine.load_model does it, but safe)
try:
from config import get_model_cache_path
cache_path = get_model_cache_path()
os.makedirs(cache_path, exist_ok=True)
logger.info(
f"Ensured model cache directory exists: {os.path.abspath(cache_path)}"
)
except Exception as e:
logger.warning(f"Could not ensure cache directory exists: {e}")
# Trigger the model loading function from the engine
logger.info("Calling engine.load_model() to initiate download if necessary...")
success = engine.load_model()
if success:
logger.info("--- Model download/load process completed successfully ---")
else:
logger.error(
"--- Model download/load process failed. Check logs for details. ---"
)
exit(1) # Exit with error code
logger.info("You can now start the server using 'python server.py'")
|