Commit 93301dad authored by Anastasia Tkach's avatar Anastasia Tkach Committed by Facebook GitHub Bot
Browse files

Running with D2Go

Summary: Pull Request resolved: https://github.com/facebookresearch/d2go/pull/442

Reviewed By: tglik

Differential Revision: D41714933

fbshipit-source-id: 5b2b3610af554f6082a4025af0673b4bc34b17ca
parent aae8381a
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
# forward the namespace to avoid `d2go.config.config` # forward the namespace to avoid `d2go.config.config`
from .config import ( from .config import (
add_cfg_nodes,
auto_scale_world_size, auto_scale_world_size,
CfgNode, CfgNode,
CONFIG_CUSTOM_PARSE_REGISTRY, CONFIG_CUSTOM_PARSE_REGISTRY,
...@@ -18,6 +19,7 @@ __all__ = [ ...@@ -18,6 +19,7 @@ __all__ = [
"CONFIG_CUSTOM_PARSE_REGISTRY", "CONFIG_CUSTOM_PARSE_REGISTRY",
"CONFIG_SCALING_METHOD_REGISTRY", "CONFIG_SCALING_METHOD_REGISTRY",
"CfgNode", "CfgNode",
"add_cfg_nodes",
"auto_scale_world_size", "auto_scale_world_size",
"load_full_config_from_file", "load_full_config_from_file",
"reroute_config_path", "reroute_config_path",
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import contextlib import contextlib
import copy import copy
import logging import logging
from typing import List from typing import Dict, List
import mock import mock
import yaml import yaml
...@@ -183,3 +183,13 @@ def load_full_config_from_file(filename: str) -> CfgNode: ...@@ -183,3 +183,13 @@ def load_full_config_from_file(filename: str) -> CfgNode:
cfg = loaded_cfg.get_default_cfg() cfg = loaded_cfg.get_default_cfg()
cfg.merge_from_other_cfg(loaded_cfg) cfg.merge_from_other_cfg(loaded_cfg)
return cfg return cfg
def add_cfg_nodes(cfg, key: str, cfg_dict: Dict):
node = CfgNode()
setattr(cfg, key, node)
for k, v in cfg_dict.items():
if isinstance(v, dict):
add_cfg_nodes(node, k, v)
else:
setattr(node, k, v)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment