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

Improve WandB logging #2341

Merged
merged 1 commit into from
Nov 21, 2024
Merged
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
9 changes: 8 additions & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,10 @@
help='use the multi-epochs-loader to save time at the beginning of every epoch')
group.add_argument('--log-wandb', action='store_true', default=False,
help='log training and validation metrics to wandb')
group.add_argument('--wandb-tags', default=[], type=str, nargs='+',
help='wandb tags')
group.add_argument('--wandb-resume-id', default='', type=str, metavar='ID',
help='If resuming a run, the id of the run in wandb')


def _parse_args():
Expand Down Expand Up @@ -814,7 +818,10 @@ def main():

if utils.is_primary(args) and args.log_wandb:
if has_wandb:
wandb.init(project=args.experiment, config=args)
assert not args.wandb_resume_id or args.resume
wandb.init(project=args.experiment, config=args, tags=args.wandb_tags,
resume='must' if args.wandb_resume_id else None,
id=args.wandb_resume_id if args.wandb_resume_id else None)
else:
_logger.warning(
"You've requested to log metrics to wandb but package not found. "
Expand Down