Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion utils/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def save_checkpoint(state: dict[str, Any], run: RunPaths, *, name: str = "last.c


def load_checkpoint(path: Path | str) -> dict[str, Any]:
return torch.load(Path(path), map_location="cpu")
"""Load tensor and primitive checkpoint state without arbitrary pickle objects."""
return torch.load(Path(path), map_location="cpu", weights_only=True)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Checkpoint Tests Are Missing

The new weights_only=True restriction has no committed regression coverage, despite the PR description stating that tests were added. Please add tests showing that tensor and primitive checkpoints still round-trip and that unsupported pickle objects are rejected; otherwise, this security-sensitive behavior could silently regress.



def save_config_snapshot(run: RunPaths, cfg: dict[str, Any], *, name: str = "config.yaml", overwrite: bool = False) -> Path:
Expand Down
Loading