File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 55import ast
66import pprint
77from abc import ABCMeta , abstractmethod
8- from typing import Dict
8+ from typing import Dict , List , Tuple
99from tabulate import tabulate
1010
1111import torch
@@ -72,6 +72,17 @@ def merge(self, cfg_list):
7272 if hasattr (self , k ):
7373 src_value = getattr (self , k )
7474 src_type = type (src_value )
75+
76+ # pre-process input if source type is list or tuple
77+ if isinstance (src_value , List ) or isinstance (src_value , Tuple ):
78+ v = v .strip ("[]()" )
79+ v = [t .strip () for t in v .split ("," )]
80+
81+ # find type of tuple
82+ if len (src_value ) > 0 :
83+ src_item_type = type (src_value [0 ])
84+ v = [src_item_type (t ) for t in v ]
85+
7586 if src_value is not None and src_type != type (v ):
7687 try :
7788 v = src_type (v )
You can’t perform that action at this time.
0 commit comments