MCPcopy Create free account
hub / github.com/dcharatan/flowmap / update_checkpoint_path

Function update_checkpoint_path

flowmap/misc/wandb_tools.py:44–64  ·  view source on GitHub ↗
(path: str | None, cfg: WandbCfg)

Source from the content-addressed store, hash-verified

42
43
44def update_checkpoint_path(path: str | None, cfg: WandbCfg) -> Path | None:
45 if path is None:
46 return None
47
48 if not str(path).startswith("wandb://"):
49 return Path(path)
50
51 run_id, *version = path[len("wandb://") :].split(":")
52 if len(version) == 0:
53 version = None
54 elif len(version) == 1:
55 version = version[0]
56 else:
57 raise ValueError("Invalid version specifier!")
58
59 project = cfg.project
60 return download_checkpoint(
61 f"{project}/{run_id}",
62 Path("checkpoints"),
63 version,
64 )

Callers 1

Calls 1

download_checkpointFunction · 0.85

Tested by

no test coverage detected