Spaces:
Running
Running
Download runtime_preload.py from Gertie2013/dalle-mini-reboot: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/spaces/Gertie2013/dalle-mini-reboot/resolve/main/runtime_preload.py
- Command line
-
hf download hf://spaces/Gertie2013/dalle-mini-reboot/runtime_preload.py
-
curl -L -o runtime_preload.py https://huggingface.co/spaces/Gertie2013/dalle-mini-reboot/resolve/main/runtime_preload.py
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 | |