Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoiding to copy a config file already placed in the logging dir #481

Closed
wants to merge 1 commit into from
Closed
Changes from all 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
8 changes: 7 additions & 1 deletion terratorch/cli_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,14 @@ 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)
# This is used to copy the exact original yaml file in the log
# directory in order to facilitate the reproducibility
if not os.path.samefile(self.config_path_original, self.config_path_new):
# When the file being used is already in the log directory, this
# operation is not necessary
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
Expand Down
Loading