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

Add option for specifying wandb save_dir from config #4379

Merged
merged 3 commits into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/asr/conf/asr_adapters/asr_adaptation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ exp_manager:
name: null
project: null
entity: null
save_dir: null

resume_if_exists: false
resume_ignore_no_checkpoint: false
6 changes: 5 additions & 1 deletion nemo/utils/exp_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,11 @@ def configure_loggers(
wandb_kwargs = {}
if "name" not in wandb_kwargs and "project" not in wandb_kwargs:
raise ValueError("name and project are required for wandb_logger")
wandb_logger = WandbLogger(save_dir=exp_dir, version=version, **wandb_kwargs)

# Update the wandb save_dir
wandb_kwargs['save_dir'] = wandb_kwargs.get('save_dir') or exp_dir
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't do get(save_dir) do get(save_dir, None) is not None else exp_dir. Also don't automatically create dir, wandb should do it for you no ?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, wandb is not creating a new directory if it does not exit. It simply creates a random dir within /tmp and starts writing logs there.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sad. Oh well. But still don't use get without a default v

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Updated.

os.makedirs(wandb_kwargs['save_dir'], exist_ok=True)
wandb_logger = WandbLogger(version=version, **wandb_kwargs)

logger_list.append(wandb_logger)
logging.info("WandBLogger has been set up")
Expand Down