Spaces:
Running on Zero
Running on Zero
Download src/utils/checkpoints.py from hugging-apps/finesplat: direct link, hf CLI and curl.
- Browser
- Download file 555 Bytes
-
https://huggingface.co/spaces/hugging-apps/finesplat/resolve/main/src/utils/checkpoints.py
- Command line
-
hf download hf://spaces/hugging-apps/finesplat/src/utils/checkpoints.py
-
curl -L -o checkpoints.py https://huggingface.co/spaces/hugging-apps/finesplat/resolve/main/src/utils/checkpoints.py
555 Bytes
| """Reading FineSplat training checkpoints.""" | |
| def checkpoint_state(ckpt: dict, use_ema: bool = False) -> dict: | |
| """Checkpoint weights under the current module names (EMA weights if ``use_ema``). | |
| Legacy ``refiner.*`` keys (and a top-level ``"refiner"`` dict) are mapped onto ``stage2.*``.""" | |
| state = ckpt.get("ema") if use_ema else None | |
| if state is None: | |
| state = ckpt.get("state", ckpt.get("refiner", ckpt)) | |
| return {("stage2." + k[len("refiner."):] if k.startswith("refiner.") else k): v | |
| for k, v in state.items()} | |