Skip to content

Commit

Permalink
refactor: match functional dir style for wandb dir
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioseel committed Nov 18, 2024
1 parent 8f3bb78 commit e5760d2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions sample_factory/cfg/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,9 +746,8 @@ def add_wandb_args(p: ArgumentParser):
)
p.add_argument(
"--wandb_dir",
default="wandb",
default=join(os.getcwd(), "wandb"),
type=str,
nargs="*",
help="Logging Directory for WandB",
)

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
4 changes: 2 additions & 2 deletions 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,7 +44,7 @@ def init_wandb_func():
tags=cfg.wandb_tags,
resume="allow",
settings=wandb.Settings(start_method="fork"),
dir=cfg.wandb_dir,
dir=wandb_dir(cfg, True),
)

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

0 comments on commit e5760d2

Please sign in to comment.