Skip to content

Commit

Permalink
Fix handling maps with integer keys (#41)
Browse files Browse the repository at this point in the history
* Trivial fix to not fail on integer keys.

* Extend example with dynamic map with integer keys.
  • Loading branch information
patricklabatut authored Apr 23, 2020
1 parent 7b06e28 commit 6188893
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions example/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@
_C.TRAIN.HYPERPARAMETER_1 = 0.1
_C.TRAIN.SCALES = (2, 4, 8, 16)

_C.DATASETS = CN(new_allowed=True)

cfg = _C
4 changes: 4 additions & 0 deletions example/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ SYSTEM:
NUM_GPUS: 2
TRAIN:
SCALES: (1, 2)
DATASETS:
train_2017:
17: 1
18: 1
2 changes: 1 addition & 1 deletion yacs/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _create_config_tree_from_dict(cls, dic, key_list):
_assert_with_logging(
_valid_type(v, allow_cfg_node=False),
"Key {} with value {} is not a valid type; valid types: {}".format(
".".join(key_list + [k]), type(v), _VALID_TYPES
".".join(key_list + [str(k)]), type(v), _VALID_TYPES
),
)
return dic
Expand Down

0 comments on commit 6188893

Please sign in to comment.