From 0f6a6a365e8f1db619f7702be9d1b2bfc86e379b Mon Sep 17 00:00:00 2001 From: Romeo Kienzler Date: Fri, 7 Mar 2025 13:37:48 +0100 Subject: [PATCH] fix 479 --- terratorch/cli_tools.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/terratorch/cli_tools.py b/terratorch/cli_tools.py index 2308e2ec..d3c50088 100644 --- a/terratorch/cli_tools.py +++ b/terratorch/cli_tools.py @@ -342,8 +342,9 @@ def setup(self, trainer: Trainer, pl_module: LightningModule, stage: str) -> Non # broadcast so that all ranks are in sync on future calls to .setup() self.already_saved = trainer.strategy.broadcast(self.already_saved) - # Copying config file to log dir - shutil.copyfile(self.config_path_original, self.config_path_new) + # Copying config file to log dir only if they are different files + if os.path.abspath(self.config_path_original) != os.path.abspath(self.config_path_new): + shutil.copyfile(self.config_path_original, self.config_path_new) class StateDictAwareModelCheckpoint(ModelCheckpoint): # necessary as we wish to have one model checkpoint with only state dict and one with standard lightning checkpoints