Skip to content

Commit

Permalink
Do not include directory structure of data config in wandb storage
Browse files Browse the repository at this point in the history
  • Loading branch information
joeloskarsson committed Jun 7, 2024
1 parent 2ac2a8b commit 10835e9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions neural_lam/models/ar_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,7 @@ def training_step(self, batch):

def on_train_start(self):
"""Save data config file to wandb at start of training"""
if self.trainer.is_global_zero:
wandb.save(self.args.data_config)
self.save_data_config()

def all_gather_cat(self, tensor_to_gather):
"""
Expand Down Expand Up @@ -528,8 +527,7 @@ def aggregate_and_plot_metrics(self, metrics_dict, prefix):

def on_test_start(self):
"""Save data config file to wandb at start of test"""
if self.trainer.is_global_zero:
wandb.save(self.args.data_config)
self.save_data_config()

def on_test_epoch_end(self):
"""
Expand Down Expand Up @@ -607,3 +605,12 @@ def on_load_checkpoint(self, checkpoint):
if not self.restore_opt:
opt = self.configure_optimizers()
checkpoint["optimizer_states"] = [opt.state_dict()]

def save_data_config(self):
"""Save data config file to wandb"""
if self.trainer.is_global_zero:
wandb.save(
self.args.data_config,
base_path=os.path.dirname(self.args.data_config),
policy="now",
)

0 comments on commit 10835e9

Please sign in to comment.