Spaces:
Running on Zero
Running on Zero
File size: 555 Bytes
6efdcce | 1 2 3 4 5 6 7 8 9 10 11 12 | """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()}
|