Skip to content

Commit

Permalink
wandb run can be resumed for eval
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianHafner committed Sep 19, 2024
1 parent 89465b4 commit e6eb1b8
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ def main():
exp_dir.mkdir(parents=True, exist_ok=True)
logger_path = exp_dir / "train.log"

if cfg.use_wandb and cfg.rank == 0:
import wandb
# initialize new wandb run
wandb.init(
project="geofm-bench",
name=exp_name,
config=OmegaConf.to_container(cfg, resolve=True),
)
cfg['wandb_run_id'] = wandb.run.id

config_log_dir = exp_dir / "configs"
config_log_dir.mkdir(exist_ok=True)
OmegaConf.save(cfg, config_log_dir / "config.yaml")
Expand All @@ -157,23 +167,22 @@ def main():
exp_name = exp_dir.name
logger_path = exp_dir / "test.log"

if cfg.use_wandb and cfg.rank == 0:
import wandb
# resume wandb run
wandb.init(
project="geofm-bench",
name=exp_name,
id=cfg.get('wandb_run_id'),
resume='allow',
)

logger = init_logger(logger_path, rank=cfg.rank)
logger.info("============ Initialized logger ============")
logger.info(pprint.pformat(OmegaConf.to_container(cfg), compact=True).strip("{}"))
logger.info("The experiment is stored in %s\n" % exp_dir)
logger.info(f"Device used: {device}")

# init wandb
if cfg.use_wandb and cfg.rank == 0:
import wandb

wandb.init(
project="geofm-bench",
name=exp_name,
config=None if cfg.eval_dir else OmegaConf.to_container(cfg, resolve=True),
resume='allow',
)

# get datasets
dataset = DATASET_REGISTRY.get(cfg.dataset.dataset_name)
dataset.download(cfg.dataset, silent=False)
Expand Down

0 comments on commit e6eb1b8

Please sign in to comment.