dalle-mini-reboot / runtime_preload.py
Gertie2013's picture John6666's picture
Upload 41 files (#2)
dbd41d3
Raw History Blame Contribute Delete
1.14 kB
"""ZeroGPU startup model preparation. No model weights are shipped in the ZIP.
startup_cuda: register models under the startup CUDA emulator (fast, VRAM resident
in the worker). cpu_ram: keep real CPU tensors in the parent, transferring only
inside GPU workers. Candidate 011 remains the default.
"""
from __future__ import annotations
import os
from weight_placement import for_engine, is_zerogpu
def prepare_engines():
if not is_zerogpu():
return {"state": "disabled", "zerogpu": False}
if os.getenv("COMPOSITE_EAGER_PRELOAD", "1") == "0":
print("Composite startup preparation DISABLED by COMPOSITE_EAGER_PRELOAD=0 (lazy diagnostic)", flush=True)
return {"state": "disabled", "zerogpu": True, "reason": "legacy_lazy_diagnostic"}
# Validate all placement values before triggering any expensive model loads.
modes = {"mini": for_engine("MINI"), "sdxl": for_engine("SDXL")}
from engines import mini, sdxl
result = {"placement": modes, "mini": mini.preload(), "sdxl": sdxl.preload()}
print(f"Composite startup model placement: {modes}; result: {result}", flush=True)
return result