From 0ef48236ed19614b9ae711ae78d05e5fb31bcab2 Mon Sep 17 00:00:00 2001 From: Markus Bilz Date: Mon, 30 Oct 2023 20:46:17 +0100 Subject: [PATCH] fix glob from Pathlib module --- src/otc/models/transformer_classifier.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/otc/models/transformer_classifier.py b/src/otc/models/transformer_classifier.py index 2b6caa29..43c76e78 100644 --- a/src/otc/models/transformer_classifier.py +++ b/src/otc/models/transformer_classifier.py @@ -89,7 +89,7 @@ def _checkpoint_write(self) -> None: """Write weights and biases to checkpoint.""" # remove old files print("deleting old checkpoints.") - for filename in Path.glob("checkpoints/tf_clf*"): + for filename in Path("checkpoints/").glob("tf_clf*"): Path.unlink(filename) # create_dir @@ -103,7 +103,7 @@ def _checkpoint_write(self) -> None: def _checkpoint_restore(self) -> None: """Restore weights and biases from checkpoint.""" print("restore from checkpoint.") - cp = Path.glob("checkpoints/tf_clf*") + cp = Path("checkpoints/").glob("tf_clf*") self.clf.load_state_dict(torch.load(cp[0])) def array_to_dataloader_finetune(