Skip to content

Commit 3a6cc4f

Browse files
sinahmrrwightman
authored andcommitted
Improve wandb logging
1 parent 620cb4f commit 3a6cc4f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

train.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,10 @@
386386
help='use the multi-epochs-loader to save time at the beginning of every epoch')
387387
group.add_argument('--log-wandb', action='store_true', default=False,
388388
help='log training and validation metrics to wandb')
389+
group.add_argument('--wandb-tags', default=[], type=str, nargs='+',
390+
help='wandb tags')
391+
group.add_argument('--wandb-resume-id', default='', type=str, metavar='ID',
392+
help='If resuming a run, the id of the run in wandb')
389393

390394

391395
def _parse_args():
@@ -814,7 +818,10 @@ def main():
814818

815819
if utils.is_primary(args) and args.log_wandb:
816820
if has_wandb:
817-
wandb.init(project=args.experiment, config=args)
821+
assert not args.wandb_resume_id or args.resume
822+
wandb.init(project=args.experiment, config=args, tags=args.wandb_tags,
823+
resume='must' if args.wandb_resume_id else None,
824+
id=args.wandb_resume_id if args.wandb_resume_id else None)
818825
else:
819826
_logger.warning(
820827
"You've requested to log metrics to wandb but package not found. "

0 commit comments

Comments
 (0)