From d72ddafe56013574e0053e15500e1f5ba293ef40 Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Wed, 29 Jul 2020 19:43:01 -0700 Subject: [PATCH] Fix some checkpoint / model str regressions --- tests/test_models.py | 9 +++++++++ timm/models/cspnet.py | 4 ++-- timm/models/res2net.py | 4 ++-- timm/models/resnet.py | 8 +------- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/test_models.py b/tests/test_models.py index d94bb6b6..df21d039 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -86,6 +86,15 @@ def test_model_default_cfgs(model_name, batch_size): assert any([k.startswith(first_conv) for k in state_dict.keys()]), f'{first_conv} not in model params' +if 'GITHUB_ACTIONS' not in os.environ: + @pytest.mark.timeout(120) + @pytest.mark.parametrize('model_name', list_models()) + @pytest.mark.parametrize('batch_size', [1]) + def test_model_load_pretrained(model_name, batch_size): + """Run a single forward pass with each model""" + create_model(model_name, pretrained=True) + + EXCLUDE_JIT_FILTERS = [ '*iabn*', 'tresnet*', # models using inplace abn unlikely to ever be scriptable 'dla*', 'hrnet*', # hopefully fix at some point diff --git a/timm/models/cspnet.py b/timm/models/cspnet.py index 67dbc128..710625d6 100644 --- a/timm/models/cspnet.py +++ b/timm/models/cspnet.py @@ -433,7 +433,7 @@ def cspresnext50(pretrained=False, **kwargs): @register_model def cspresnext50_iabn(pretrained=False, **kwargs): norm_layer = get_norm_act_layer('iabn') - return _create_cspnet('cspresnext50', pretrained=pretrained, norm_layer=norm_layer, **kwargs) + return _create_cspnet('cspresnext50_iabn', pretrained=pretrained, norm_layer=norm_layer, **kwargs) @register_model @@ -444,7 +444,7 @@ def cspdarknet53(pretrained=False, **kwargs): @register_model def cspdarknet53_iabn(pretrained=False, **kwargs): norm_layer = get_norm_act_layer('iabn') - return _create_cspnet('cspdarknet53', pretrained=pretrained, block_fn=DarkBlock, norm_layer=norm_layer, **kwargs) + return _create_cspnet('cspdarknet53_iabn', pretrained=pretrained, block_fn=DarkBlock, norm_layer=norm_layer, **kwargs) @register_model diff --git a/timm/models/res2net.py b/timm/models/res2net.py index ae753d12..6e51d491 100644 --- a/timm/models/res2net.py +++ b/timm/models/res2net.py @@ -189,7 +189,7 @@ def res2net50_48w_2s(pretrained=False, **kwargs): """ model_args = dict( block=Bottle2neck, layers=[3, 4, 6, 3], base_width=48, block_args=dict(scale=2), **kwargs) - return _create_res2net('res2net50_26w_8s', pretrained, **model_args) + return _create_res2net('res2net50_48w_2s', pretrained, **model_args) @register_model @@ -200,7 +200,7 @@ def res2net50_14w_8s(pretrained=False, **kwargs): """ model_args = dict( block=Bottle2neck, layers=[3, 4, 6, 3], base_width=14, block_args=dict(scale=8), **kwargs) - return _create_res2net('res2net50_26w_8s', pretrained, **model_args) + return _create_res2net('res2net50_14w_8s', pretrained, **model_args) @register_model diff --git a/timm/models/resnet.py b/timm/models/resnet.py index d8fb1406..37b5e82e 100644 --- a/timm/models/resnet.py +++ b/timm/models/resnet.py @@ -624,7 +624,7 @@ def resnet26d(pretrained=False, **kwargs): """Constructs a ResNet-26 v1d model. This is technically a 28 layer ResNet, sticking with 'd' modifier from Gluon for now. """ - model_args = dict(block=Bottleneck, layers=[2, 2, 2, 2], stem_type='deep', avg_down=True, **kwargs) + model_args = dict(block=Bottleneck, layers=[2, 2, 2, 2], stem_width=32, stem_type='deep', avg_down=True, **kwargs) return _create_resnet('resnet26d', pretrained, **model_args) @@ -1129,9 +1129,3 @@ def senet154(pretrained=False, **kwargs): block=Bottleneck, layers=[3, 8, 36, 3], cardinality=64, base_width=4, stem_type='deep', down_kernel_size=3, block_reduce_first=2, block_args=dict(attn_layer='se'), **kwargs) return _create_resnet('senet154', pretrained, **model_args) - - -@register_model -def eseresnet50(pretrained=False, **kwargs): - model_args = dict(block=Bottleneck, layers=[3, 4, 6, 3], block_args=dict(attn_layer='ese'), **kwargs) - return _create_resnet('seresnet50', pretrained, **model_args)