Skip to content
Open
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
5 changes: 4 additions & 1 deletion opf/_common/checkpoint_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,16 @@ def _promote_original_subtree(target: Path) -> None:
f"Downloaded checkpoint is missing expected subtree: {original_dir}"
)

for path in original_dir.iterdir():
entries = list(original_dir.iterdir())
for path in entries:
destination = target / path.name
if destination.exists():
raise RuntimeError(
"Cannot promote downloaded checkpoint file because destination "
f"already exists: {destination}"
)
for path in entries:
destination = target / path.name
shutil.move(str(path), str(destination))
original_dir.rmdir()

Expand Down