Skip to content
Merged
Changes from 2 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
6 changes: 4 additions & 2 deletions ignite/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,11 @@ def hash_checkpoint(checkpoint_path: Union[str, Path], output_dir: Union[str, Pa

Args:
checkpoint_path: Path to the checkpoint file.
output_dir: Output directory to store the hashed checkpoint file.
output_dir: Output directory to store the hashed checkpoint file
(will be created if not exist).

Returns:
Path to the hashed checkpoint file, The 8 digits of SHA256 hash.
Path to the hashed checkpoint file, the first 8 digits of SHA256 hash.

.. versionadded:: 0.5.0
"""
Expand All @@ -305,6 +306,7 @@ def hash_checkpoint(checkpoint_path: Union[str, Path], output_dir: Union[str, Pa

if isinstance(output_dir, str):
output_dir = Path(output_dir)
output_dir.mkdir(parents=True, exist_ok=True)

sha_hash = hashlib.sha256(checkpoint_path.read_bytes()).hexdigest()
old_filename = checkpoint_path.stem
Expand Down