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

Some Quickfixes on W&B #772

Merged
merged 1 commit into from
Apr 16, 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
24 changes: 14 additions & 10 deletions torchtune/utils/metric_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,15 @@ def __init__(
_, self.rank = get_world_size_and_rank()

if self.rank == 0:
self._wandb.init(
run = self._wandb.init(
project=project,
entity=entity,
group=group,
reinit=True,
resume="allow",
**kwargs,
)
run._label(repo="torchtune")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain this a little more? What does the repo kwarg enable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We get telemetry on the repo usage. We already do this by grabbing the git repo used to train but if people rename it or fork it can mess up the identification. We can share this data with you guys to see adoption.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In practice, it is just one extra key in: https://wandb.ai/capecape/torchtune/runs/ynahtfyw/files/config.yaml
the key 9

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense, thanks for the explanation! (We would love to see adoption numbers soon :) )


def log_config(self, config: DictConfig) -> None:
"""Saves the config locally and also logs the config to W&B. The config is
Expand All @@ -197,22 +198,25 @@ def log_config(self, config: DictConfig) -> None:
if self._wandb.run:
resolved = OmegaConf.to_container(config, resolve=True)
self._wandb.config.update(resolved)

output_config_fname = Path(
os.path.join(
config.checkpointer.checkpoint_dir,
f"torchtune_config_{self._wandb.run.id}.yaml",
)
)
OmegaConf.save(config, output_config_fname)
try:
output_config_fname = Path(
os.path.join(
config.checkpointer.checkpoint_dir,
f"torchtune_config_{self._wandb.run.id}.yaml",
)
)
OmegaConf.save(config, output_config_fname)

log.info(f"Logging {output_config_fname} to W&B under Files")
self._wandb.save(
output_config_fname, base_path=output_config_fname.parent
)

except Exception as e:
log.warning(f"Error saving {output_config_fname} to W&B.\nError: \n{e}")
log.warning(
f"Error saving {output_config_fname} to W&B.\nError: \n{e}."
"Don't worry the config will be logged the W&B workspace"
)

def log(self, name: str, data: Scalar, step: int) -> None:
if self._wandb.run:
Expand Down
Loading