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

[fix] log_dir with W&B #777

Merged
merged 2 commits into from
Apr 16, 2024
Merged
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions torchtune/utils/metric_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class WandBLogger(MetricLoggerInterface):
project (str): WandB project name
entity (Optional[str]): WandB entity name
group (Optional[str]): WandB group name
log_dir (Optional[str]): WandB log directory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should explain what's used if this is not specified (or if dir is specified)

**kwargs: additional arguments to pass to wandb.init

Example:
Expand All @@ -162,6 +163,7 @@ def __init__(
project: str = "torchtune",
entity: Optional[str] = None,
group: Optional[str] = None,
log_dir: Optional[str] = None,
**kwargs,
):
try:
Expand All @@ -173,6 +175,9 @@ def __init__(
) from e
self._wandb = wandb

# remove "dir" from kwargs
self.log_dir = kwargs.pop("dir", log_dir)

_, self.rank = get_world_size_and_rank()

if self.rank == 0:
Expand All @@ -182,6 +187,7 @@ def __init__(
group=group,
reinit=True,
resume="allow",
dir=self.log_dir,
**kwargs,
)
run._label(repo="torchtune")
Expand Down