Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

[minor][wandb] Save task arguments as separate config values #4484

Merged
merged 3 commits into from
Apr 5, 2022
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
13 changes: 12 additions & 1 deletion parlai/core/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,25 @@ def __init__(self, opt: Opt, model=None):
entity=opt.get('wandb_entity'),
reinit=True, # in case of preemption
resume=True, # requeued runs should be treated as single run
allow_val_change=True,
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 leave a comment why

)
# suppress wandb's output
logging.getLogger("wandb").setLevel(logging.ERROR)

def set_config_value(self, key, value):
if self.run.config.get(key, None) != None:
setattr(self.run.config, k, v)

if not self.run.resumed:
for key, value in opt.items():
if value is None or isinstance(value, (str, numbers.Number, tuple)):
setattr(self.run.config, key, value)
set_config_value(self, key, value)
if key == "task": # For ags specified in the task argument
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: spelling

maybe_task_opts = value.split(":")
for task_opt in maybe_task_opts:
if len(task_opt.split("=")) == 2:
k, v = task_opt.split("=")
set_config_value(self, k, v)
if model is not None:
self.run.watch(model)

Expand Down