From 93c1240dfd18e1bf1e1750c9ede0cf6853cee620 Mon Sep 17 00:00:00 2001 From: Luca Moschella Date: Thu, 3 Feb 2022 20:18:31 +0100 Subject: [PATCH 1/2] Refactor references to organization name into grok-ai --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 228784b..c6c734c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,7 +6,7 @@ author = Valentino Maiorca author_email = valentino@maiorca.xyz keywords = python, torch license = MIT License -url = https://github.com/Flegyas/nn-template-core +url = https://github.com/grok-ai/nn-template-core [options] zip_safe = False From 50463fa44c5d4987bf9dfa2b932fdcd420d7fc86 Mon Sep 17 00:00:00 2001 From: Giorgio Mariani Date: Mon, 21 Feb 2022 15:36:27 +0100 Subject: [PATCH 2/2] Change compression fn to save empty metadata dir This commit fixes an issue when storing checkpoints with no metadata. Now the metadata folder is stored in the compressed checkpoint even if there are no files inside. This avoids an error when trying to load the checkpoint. --- src/nn_core/serialization.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/nn_core/serialization.py b/src/nn_core/serialization.py index 5391393..1d8d366 100644 --- a/src/nn_core/serialization.py +++ b/src/nn_core/serialization.py @@ -95,6 +95,13 @@ def compress_checkpoint(src_dir: Path, dst_file: Path, delete_dir: bool = True): with zipfile.ZipFile(_normalize_path(dst_file), "w") as zip_file: for folder, subfolders, files in os.walk(src_dir): folder: Path = Path(folder) + for subfolder in subfolders: + zip_file.write( + folder / subfolder, + (folder / subfolder).relative_to(src_dir), + compress_type=zipfile.ZIP_DEFLATED, + ) + for file in files: zip_file.write( folder / file,