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

Copy extra_init_params to get rid of recursive config dicts #316

Merged
merged 6 commits into from
Feb 3, 2022
Merged
Changes from 2 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
7 changes: 4 additions & 3 deletions composer/loggers/logger_hparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,10 @@ def get_flattened_dict(data: Dict[str, Any], _prefix: List[str] = []) -> Dict[st
all_items[key_name] = val
return all_items

# extra_init_params may be in ``config`` already. Copy it so we don't get recursive dicts.
self.extra_init_params = copy.deepcopy(self.extra_init_params)
if self.flatten_hparams:
config = get_flattened_dict(data=config)
else:
config = copy.deepcopy(config) # Copy since WandB parameters are part of config

if "config" not in self.extra_init_params:
self.extra_init_params["config"] = {}
if not isinstance(self.extra_init_params["config"], dict):
Expand All @@ -176,6 +175,8 @@ def get_flattened_dict(data: Dict[str, Any], _prefix: List[str] = []) -> Dict[st
)
self.extra_init_params["config"].update(config)



hanlint marked this conversation as resolved.
Show resolved Hide resolved
name_suffix = f"Rank {dist.get_global_rank()}"
name = f"{self.name}_{name_suffix}" if self.name else name_suffix
group = self.name if (not self.group and self.rank_zero_only) else self.group
Expand Down