@@ -39,20 +39,17 @@ def create_model(
39
39
kwargs .pop ('bn_momentum' , None )
40
40
kwargs .pop ('bn_eps' , None )
41
41
42
- # Parameters that aren't supported by all models should default to None in command line args,
43
- # remove them if they are present and not set so that non-supporting models don't break.
44
- if kwargs .get ('drop_block_rate' , None ) is None :
45
- kwargs .pop ('drop_block_rate' , None )
46
-
47
42
# handle backwards compat with drop_connect -> drop_path change
48
43
drop_connect_rate = kwargs .pop ('drop_connect_rate' , None )
49
44
if drop_connect_rate is not None and kwargs .get ('drop_path_rate' , None ) is None :
50
45
print ("WARNING: 'drop_connect' as an argument is deprecated, please use 'drop_path'."
51
46
" Setting drop_path to %f." % drop_connect_rate )
52
47
kwargs ['drop_path_rate' ] = drop_connect_rate
53
48
54
- if kwargs .get ('drop_path_rate' , None ) is None :
55
- kwargs .pop ('drop_path_rate' , None )
49
+ # Parameters that aren't supported by all models or are intended to only override model defaults if set
50
+ # should default to None in command line args/cfg. Remove them if they are present and not set so that
51
+ # non-supporting models don't break and default args remain in effect.
52
+ kwargs = {k : v for k , v in kwargs .items () if v is not None }
56
53
57
54
with set_layer_config (scriptable = scriptable , exportable = exportable , no_jit = no_jit ):
58
55
if is_model (model_name ):
0 commit comments