Make more test models smaller (#25005)

* Make more test models tiny

* Make more test models tiny

* More models

* More models
This commit is contained in:
Sylvain Gugger
2023-07-24 10:08:47 -04:00
committed by GitHub
parent 8f1f0bf50f
commit 42571f6eb8
22 changed files with 149 additions and 137 deletions

View File

@@ -62,6 +62,7 @@ class DPTModelTester:
attention_probs_dropout_prob=0.1,
initializer_range=0.02,
num_labels=3,
neck_hidden_sizes=[16, 16, 32, 32],
is_hybrid=False,
scope=None,
):
@@ -84,6 +85,7 @@ class DPTModelTester:
self.num_labels = num_labels
self.scope = scope
self.is_hybrid = is_hybrid
self.neck_hidden_sizes = neck_hidden_sizes
# sequence length of DPT = num_patches + 1 (we add 1 for the [CLS] token)
num_patches = (image_size // patch_size) ** 2
self.seq_length = num_patches + 1
@@ -105,6 +107,7 @@ class DPTModelTester:
patch_size=self.patch_size,
num_channels=self.num_channels,
hidden_size=self.hidden_size,
fusion_hidden_size=self.hidden_size,
num_hidden_layers=self.num_hidden_layers,
backbone_out_indices=self.backbone_out_indices,
num_attention_heads=self.num_attention_heads,
@@ -115,6 +118,7 @@ class DPTModelTester:
is_decoder=False,
initializer_range=self.initializer_range,
is_hybrid=self.is_hybrid,
neck_hidden_sizes=self.neck_hidden_sizes,
)
def create_and_check_model(self, config, pixel_values, labels):
@@ -275,10 +279,6 @@ class DPTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
msg=f"Parameter {name} of model {model_class} seems not properly initialized",
)
@unittest.skip("Will be fixed soon by reducing the size of the model used for common tests.")
def test_model_is_small(self):
pass
@slow
def test_model_from_pretrained(self):
for model_name in DPT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:

View File

@@ -62,7 +62,8 @@ class DPTModelTester:
attention_probs_dropout_prob=0.1,
initializer_range=0.02,
num_labels=3,
backbone_featmap_shape=[1, 384, 24, 24],
backbone_featmap_shape=[1, 32, 24, 24],
neck_hidden_sizes=[16, 16, 32, 32],
is_hybrid=True,
scope=None,
):
@@ -86,6 +87,7 @@ class DPTModelTester:
self.backbone_featmap_shape = backbone_featmap_shape
self.scope = scope
self.is_hybrid = is_hybrid
self.neck_hidden_sizes = neck_hidden_sizes
# sequence length of DPT = num_patches + 1 (we add 1 for the [CLS] token)
num_patches = (image_size // patch_size) ** 2
self.seq_length = num_patches + 1
@@ -108,7 +110,7 @@ class DPTModelTester:
"depths": [3, 4, 9],
"out_features": ["stage1", "stage2", "stage3"],
"embedding_dynamic_padding": True,
"hidden_sizes": [96, 192, 384, 768],
"hidden_sizes": [16, 16, 32, 32],
"num_groups": 2,
}
@@ -117,6 +119,7 @@ class DPTModelTester:
patch_size=self.patch_size,
num_channels=self.num_channels,
hidden_size=self.hidden_size,
fusion_hidden_size=self.hidden_size,
num_hidden_layers=self.num_hidden_layers,
backbone_out_indices=self.backbone_out_indices,
num_attention_heads=self.num_attention_heads,
@@ -129,6 +132,7 @@ class DPTModelTester:
is_hybrid=self.is_hybrid,
backbone_config=backbone_config,
backbone_featmap_shape=self.backbone_featmap_shape,
neck_hidden_sizes=self.neck_hidden_sizes,
)
def create_and_check_model(self, config, pixel_values, labels):
@@ -289,10 +293,6 @@ class DPTModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
msg=f"Parameter {name} of model {model_class} seems not properly initialized",
)
@unittest.skip("Will be fixed soon by reducing the size of the model used for common tests.")
def test_model_is_small(self):
pass
@slow
def test_model_from_pretrained(self):
for model_name in DPT_PRETRAINED_MODEL_ARCHIVE_LIST[1:]: