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