@@ -39,20 +39,17 @@ def create_model(
3939 kwargs .pop ('bn_momentum' , None )
4040 kwargs .pop ('bn_eps' , None )
4141
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-
4742 # handle backwards compat with drop_connect -> drop_path change
4843 drop_connect_rate = kwargs .pop ('drop_connect_rate' , None )
4944 if drop_connect_rate is not None and kwargs .get ('drop_path_rate' , None ) is None :
5045 print ("WARNING: 'drop_connect' as an argument is deprecated, please use 'drop_path'."
5146 " Setting drop_path to %f." % drop_connect_rate )
5247 kwargs ['drop_path_rate' ] = drop_connect_rate
5348
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 }
5653
5754 with set_layer_config (scriptable = scriptable , exportable = exportable , no_jit = no_jit ):
5855 if is_model (model_name ):
0 commit comments