Skip to content

Commit

Permalink
Merge pull request #132 from mmoffatt2/master
Browse files Browse the repository at this point in the history
Create Same Timestamp For Tensorboard Logs and Output Checkpoints
  • Loading branch information
gkielian authored Apr 6, 2024
2 parents 1a24fe6 + fe3186d commit afe62b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions run_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ def run_command(config, config_basename, output_dir, csv_ckpt_dir, prefix, add_n
best_val_loss_from, override_max_iters, override_dataset, override_block_size):
formatted_name = format_config_name(config, config_basename, prefix, add_names)
config['tensorboard_run_name'] = formatted_name
config['out_dir'] = os.path.join(output_dir, f"{datetime.now().strftime('%Y%m%d_%H%M%S')}_{formatted_name}")

timestamp_prefix = datetime.now().strftime('%Y%m%d_%H%M%S')
config['out_dir'] = os.path.join(output_dir, f"{timestamp_prefix}_{formatted_name}")
base_command.extend(["--timestamp", timestamp_prefix])

if override_max_iters:
config['max_iters'] = str(override_max_iters)
if override_dataset:
Expand Down
3 changes: 3 additions & 0 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def parse_args():
# Logging args
logging_group.add_argument('--log_project', default='out-test', type=str)
logging_group.add_argument('--log_run_name', default='logs-test', type=str)
logging_group.add_argument('--timestamp', default='', type=str)

# CSV logging
logging_group.add_argument('--csv_log', default=True, action=argparse.BooleanOptionalAction)
Expand Down Expand Up @@ -305,6 +306,8 @@ def setup(self):
self.raw_model = self.model.module if self.ddp else self.model

timestamp_prefix = time.strftime("%Y%m%d-%H%M%S")
if self.args.timestamp:
timestamp_prefix = self.args.timestamp

# Tensorboard
if self.args.tensorboard_log:
Expand Down

0 comments on commit afe62b9

Please sign in to comment.