diff --git a/tests/models/bit/test_modeling_bit.py b/tests/models/bit/test_modeling_bit.py index 504e410bb466a8..f04b77d5e46084 100644 --- a/tests/models/bit/test_modeling_bit.py +++ b/tests/models/bit/test_modeling_bit.py @@ -52,7 +52,6 @@ def __init__( hidden_act="relu", num_labels=3, scope=None, - out_features=["stage2", "stage3", "stage4"], out_indices=[2, 3, 4], num_groups=1, ): @@ -69,7 +68,6 @@ def __init__( self.num_labels = num_labels self.scope = scope self.num_stages = len(hidden_sizes) - self.out_features = out_features self.out_indices = out_indices self.num_groups = num_groups @@ -92,7 +90,6 @@ def get_config(self): depths=self.depths, hidden_act=self.hidden_act, num_labels=self.num_labels, - out_features=self.out_features, out_indices=self.out_indices, num_groups=self.num_groups, ) @@ -122,15 +119,15 @@ def create_and_check_backbone(self, config, pixel_values, labels): result = model(pixel_values) # verify feature maps - self.parent.assertEqual(len(result.feature_maps), len(config.out_features)) + self.parent.assertEqual(len(result.feature_maps), len(config.out_indices)) self.parent.assertListEqual(list(result.feature_maps[0].shape), [self.batch_size, self.hidden_sizes[1], 4, 4]) # verify channels - self.parent.assertEqual(len(model.channels), len(config.out_features)) + self.parent.assertEqual(len(model.channels), len(config.out_indices)) self.parent.assertListEqual(model.channels, config.hidden_sizes[1:]) - # verify backbone works with out_features=None - config.out_features = None + # verify backbone works with out_indices=None + config.out_indices = None model = BitBackbone(config=config) model.to(torch_device) model.eval() diff --git a/tests/models/conditional_detr/test_modeling_conditional_detr.py b/tests/models/conditional_detr/test_modeling_conditional_detr.py index 2e2973679e91b3..7d83e8d94348b8 100644 --- a/tests/models/conditional_detr/test_modeling_conditional_detr.py +++ b/tests/models/conditional_detr/test_modeling_conditional_detr.py @@ -116,7 +116,6 @@ def get_config(self): depths=[1, 1, 2, 1], hidden_act="relu", num_labels=3, - out_features=["stage2", "stage3", "stage4"], out_indices=[2, 3, 4], ) return ConditionalDetrConfig( diff --git a/tests/models/convnext/test_modeling_convnext.py b/tests/models/convnext/test_modeling_convnext.py index 7d7ba5c9b80e6d..bab5cffa196eaa 100644 --- a/tests/models/convnext/test_modeling_convnext.py +++ b/tests/models/convnext/test_modeling_convnext.py @@ -54,7 +54,6 @@ def __init__( hidden_act="gelu", num_labels=10, initializer_range=0.02, - out_features=["stage2", "stage3", "stage4"], out_indices=[2, 3, 4], scope=None, ): @@ -71,7 +70,6 @@ def __init__( self.hidden_act = hidden_act self.num_labels = num_labels self.initializer_range = initializer_range - self.out_features = out_features self.out_indices = out_indices self.scope = scope @@ -94,7 +92,6 @@ def get_config(self): hidden_act=self.hidden_act, is_decoder=False, initializer_range=self.initializer_range, - out_features=self.out_features, out_indices=self.out_indices, num_labels=self.num_labels, ) @@ -124,15 +121,15 @@ def create_and_check_backbone(self, config, pixel_values, labels): result = model(pixel_values) # verify hidden states - self.parent.assertEqual(len(result.feature_maps), len(config.out_features)) + self.parent.assertEqual(len(result.feature_maps), len(config.out_indices)) self.parent.assertListEqual(list(result.feature_maps[0].shape), [self.batch_size, self.hidden_sizes[1], 4, 4]) # verify channels - self.parent.assertEqual(len(model.channels), len(config.out_features)) + self.parent.assertEqual(len(model.channels), len(config.out_indices)) self.parent.assertListEqual(model.channels, config.hidden_sizes[1:]) - # verify backbone works with out_features=None - config.out_features = None + # verify backbone works with out_indices=None + config.out_indices = None model = ConvNextBackbone(config=config) model.to(torch_device) model.eval() diff --git a/tests/models/convnextv2/test_modeling_convnextv2.py b/tests/models/convnextv2/test_modeling_convnextv2.py index e5bb8e3d190a03..46b81c2f362eaa 100644 --- a/tests/models/convnextv2/test_modeling_convnextv2.py +++ b/tests/models/convnextv2/test_modeling_convnextv2.py @@ -55,7 +55,6 @@ def __init__( hidden_act="gelu", num_labels=10, initializer_range=0.02, - out_features=["stage2", "stage3", "stage4"], out_indices=[2, 3, 4], scope=None, ): @@ -72,7 +71,6 @@ def __init__( self.hidden_act = hidden_act self.num_labels = num_labels self.initializer_range = initializer_range - self.out_features = out_features self.out_indices = out_indices self.scope = scope @@ -96,7 +94,6 @@ def get_config(self): hidden_act=self.hidden_act, is_decoder=False, initializer_range=self.initializer_range, - out_features=self.out_features, out_indices=self.out_indices, num_labels=self.num_labels, ) @@ -126,15 +123,15 @@ def create_and_check_backbone(self, config, pixel_values, labels): result = model(pixel_values) # verify hidden states - self.parent.assertEqual(len(result.feature_maps), len(config.out_features)) + self.parent.assertEqual(len(result.feature_maps), len(config.out_indices)) self.parent.assertListEqual(list(result.feature_maps[0].shape), [self.batch_size, self.hidden_sizes[1], 4, 4]) # verify channels - self.parent.assertEqual(len(model.channels), len(config.out_features)) + self.parent.assertEqual(len(model.channels), len(config.out_indices)) self.parent.assertListEqual(model.channels, config.hidden_sizes[1:]) - # verify backbone works with out_features=None - config.out_features = None + # verify backbone works with out_indices=None + config.out_indices = None model = ConvNextV2Backbone(config=config) model.to(torch_device) model.eval() diff --git a/tests/models/deformable_detr/test_modeling_deformable_detr.py b/tests/models/deformable_detr/test_modeling_deformable_detr.py index b77ffb6e7778e9..5a3f03f88ec2f8 100644 --- a/tests/models/deformable_detr/test_modeling_deformable_detr.py +++ b/tests/models/deformable_detr/test_modeling_deformable_detr.py @@ -130,7 +130,6 @@ def get_config(self): depths=[1, 1, 2, 1], hidden_act="relu", num_labels=3, - out_features=["stage2", "stage3", "stage4"], out_indices=[2, 3, 4], ) return DeformableDetrConfig( diff --git a/tests/models/detr/test_modeling_detr.py b/tests/models/detr/test_modeling_detr.py index d1e36e32824d74..580ce7cd8fc6fb 100644 --- a/tests/models/detr/test_modeling_detr.py +++ b/tests/models/detr/test_modeling_detr.py @@ -112,7 +112,6 @@ def get_config(self): depths=[1, 1, 2, 1], hidden_act="relu", num_labels=3, - out_features=["stage2", "stage3", "stage4"], out_indices=[2, 3, 4], ) return DetrConfig( diff --git a/tests/models/dinat/test_modeling_dinat.py b/tests/models/dinat/test_modeling_dinat.py index 7cfb5846e071fc..0bc0f0b6ede04f 100644 --- a/tests/models/dinat/test_modeling_dinat.py +++ b/tests/models/dinat/test_modeling_dinat.py @@ -65,7 +65,6 @@ def __init__( scope=None, use_labels=True, num_labels=10, - out_features=["stage1", "stage2"], out_indices=[1, 2], ): self.parent = parent @@ -91,7 +90,6 @@ def __init__( self.scope = scope self.use_labels = use_labels self.num_labels = num_labels - self.out_features = out_features self.out_indices = out_indices def prepare_config_and_inputs(self): @@ -125,7 +123,6 @@ def get_config(self): patch_norm=self.patch_norm, layer_norm_eps=self.layer_norm_eps, initializer_range=self.initializer_range, - out_features=self.out_features, out_indices=self.out_indices, ) @@ -166,14 +163,14 @@ def create_and_check_backbone(self, config, pixel_values, labels): result = model(pixel_values) # verify hidden states - self.parent.assertEqual(len(result.feature_maps), len(config.out_features)) + self.parent.assertEqual(len(result.feature_maps), len(config.out_indices)) self.parent.assertListEqual(list(result.feature_maps[0].shape), [self.batch_size, model.channels[0], 16, 16]) # verify channels - self.parent.assertEqual(len(model.channels), len(config.out_features)) + self.parent.assertEqual(len(model.channels), len(config.out_indices)) - # verify backbone works with out_features=None - config.out_features = None + # verify backbone works with out_indices=None + config.out_indices = None model = DinatBackbone(config=config) model.to(torch_device) model.eval() diff --git a/tests/models/swin/test_modeling_swin.py b/tests/models/swin/test_modeling_swin.py index 963de232d68eee..f39d37b56e903a 100644 --- a/tests/models/swin/test_modeling_swin.py +++ b/tests/models/swin/test_modeling_swin.py @@ -67,7 +67,6 @@ def __init__( use_labels=True, type_sequence_label_size=10, encoder_stride=8, - out_features=["stage1", "stage2"], out_indices=[1, 2], ): self.parent = parent @@ -94,7 +93,6 @@ def __init__( self.use_labels = use_labels self.type_sequence_label_size = type_sequence_label_size self.encoder_stride = encoder_stride - self.out_features = out_features self.out_indices = out_indices def prepare_config_and_inputs(self): @@ -128,7 +126,6 @@ def get_config(self): layer_norm_eps=self.layer_norm_eps, initializer_range=self.initializer_range, encoder_stride=self.encoder_stride, - out_features=self.out_features, out_indices=self.out_indices, ) @@ -150,14 +147,14 @@ def create_and_check_backbone(self, config, pixel_values, labels): result = model(pixel_values) # verify hidden states - self.parent.assertEqual(len(result.feature_maps), len(config.out_features)) + self.parent.assertEqual(len(result.feature_maps), len(config.out_indices)) self.parent.assertListEqual(list(result.feature_maps[0].shape), [self.batch_size, model.channels[0], 16, 16]) # verify channels - self.parent.assertEqual(len(model.channels), len(config.out_features)) + self.parent.assertEqual(len(model.channels), len(config.out_indices)) - # verify backbone works with out_features=None - config.out_features = None + # verify backbone works with out_indices=None + config.out_indices = None model = SwinBackbone(config=config) model.to(torch_device) model.eval() diff --git a/tests/models/tvp/test_modeling_tvp.py b/tests/models/tvp/test_modeling_tvp.py index 2912b877842447..f44d1e0b46e099 100644 --- a/tests/models/tvp/test_modeling_tvp.py +++ b/tests/models/tvp/test_modeling_tvp.py @@ -118,7 +118,6 @@ def get_config(self): hidden_sizes=[64, 128], depths=[2, 2], hidden_act="relu", - out_features=["stage2"], out_indices=[2], ) return TvpConfig( diff --git a/tests/models/upernet/test_modeling_upernet.py b/tests/models/upernet/test_modeling_upernet.py index 464061915e8b3d..53a18ed7f300ef 100644 --- a/tests/models/upernet/test_modeling_upernet.py +++ b/tests/models/upernet/test_modeling_upernet.py @@ -62,7 +62,7 @@ def __init__( hidden_act="gelu", type_sequence_label_size=10, initializer_range=0.02, - out_features=["stage2", "stage3", "stage4"], + out_indices=[2, 3, 4], num_labels=3, scope=None, ): @@ -79,7 +79,7 @@ def __init__( self.hidden_act = hidden_act self.type_sequence_label_size = type_sequence_label_size self.initializer_range = initializer_range - self.out_features = out_features + self.out_indices = out_indices self.num_labels = num_labels self.scope = scope self.num_hidden_layers = num_stages @@ -104,7 +104,7 @@ def get_backbone_config(self): is_training=self.is_training, intermediate_size=self.intermediate_size, hidden_act=self.hidden_act, - out_features=self.out_features, + out_indices=self.out_indices, ) def get_config(self): diff --git a/tests/models/zoedepth/test_modeling_zoedepth.py b/tests/models/zoedepth/test_modeling_zoedepth.py index 571c44f2f47266..53e776df822ef2 100644 --- a/tests/models/zoedepth/test_modeling_zoedepth.py +++ b/tests/models/zoedepth/test_modeling_zoedepth.py @@ -52,7 +52,7 @@ def __init__( num_hidden_layers=2, num_attention_heads=2, intermediate_size=8, - out_features=["stage1", "stage2"], + out_indices=[1, 2], apply_layernorm=False, reshape_hidden_states=False, neck_hidden_sizes=[2, 2], @@ -69,7 +69,7 @@ def __init__( self.num_hidden_layers = num_hidden_layers self.num_attention_heads = num_attention_heads self.intermediate_size = intermediate_size - self.out_features = out_features + self.out_indices = out_indices self.apply_layernorm = apply_layernorm self.reshape_hidden_states = reshape_hidden_states self.use_labels = use_labels @@ -113,7 +113,7 @@ def get_backbone_config(self): num_attention_heads=self.num_attention_heads, intermediate_size=self.intermediate_size, is_training=self.is_training, - out_features=self.out_features, + out_indices=self.out_indices, reshape_hidden_states=self.reshape_hidden_states, )