Skip to content

Commit

Permalink
[Enhancement] Enhance the output of exception (open-mmlab#1309)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouzaida authored Sep 7, 2021
1 parent 4f4eb27 commit eed9cce
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mmcv/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,10 @@ def _file2dict(filename, use_predefined_variables=True):

base_cfg_dict = dict()
for c in cfg_dict_list:
if len(base_cfg_dict.keys() & c.keys()) > 0:
raise KeyError('Duplicate key is not allowed among bases')
duplicate_keys = base_cfg_dict.keys() & c.keys()
if len(duplicate_keys) > 0:
raise KeyError('Duplicate key is not allowed among bases. '
f'Duplicate keys: {duplicate_keys}')
base_cfg_dict.update(c)

# Subtitute base variables from strings to their actual values
Expand Down

0 comments on commit eed9cce

Please sign in to comment.