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

Feature: add wandb dir as parser argument #308

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions sample_factory/cfg/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,12 @@ def add_wandb_args(p: ArgumentParser):
nargs="*",
help="Tags can help with finding experiments in WandB web console",
)
p.add_argument(
Copy link
Owner

Choose a reason for hiding this comment

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

👍

"--wandb_dir",
default=join(os.getcwd(), "wandb"),
type=str,
help="Logging Directory for WandB",
)


def add_pbt_args(p: ArgumentParser):
Expand Down
4 changes: 4 additions & 0 deletions sample_factory/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,10 @@ def experiments_dir(cfg, mkdir=True) -> str:
return maybe_ensure_dir_exists(cfg.train_dir, mkdir)


def wandb_dir(cfg, mkdir=True) -> str:
return maybe_ensure_dir_exists(cfg.wandb_dir, mkdir)


def experiment_dir(cfg, mkdir=True) -> str:
experiment = cfg.experiment
experiments_root = experiments_dir(cfg, mkdir)
Expand Down
3 changes: 2 additions & 1 deletion sample_factory/utils/wandb_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from datetime import datetime

from sample_factory.utils.utils import log, retry
from sample_factory.utils.utils import log, retry, wandb_dir


def init_wandb(cfg):
Expand Down Expand Up @@ -44,6 +44,7 @@ def init_wandb_func():
tags=cfg.wandb_tags,
resume="allow",
settings=wandb.Settings(start_method="fork"),
dir=wandb_dir(cfg, True),
)

log.debug("Initializing WandB...")
Expand Down
Loading