Skip to content

Commit

Permalink
Copy extra_init_params to get rid of recursive config dicts (#316)
Browse files Browse the repository at this point in the history
* Copy extra_init_params to get rid of recursive config dicts

* remove empty lines

Co-authored-by: hanlint <hanlin@mosaicml.com>
  • Loading branch information
siriuslee and hanlint committed Feb 3, 2022
1 parent 3528d13 commit 22f610e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions composer/loggers/logger_hparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,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 Down

0 comments on commit 22f610e

Please sign in to comment.