Check models used for common tests are small (#24824)

* First models

* Conditional DETR

* Treat DETR models, skip others

* Skip LayoutLMv2 as well

* Fix last tests
This commit is contained in:
Sylvain Gugger
2023-07-14 14:43:19 -04:00
committed by GitHub
parent a865b62e07
commit 1023705440
43 changed files with 305 additions and 116 deletions

View File

@@ -2705,6 +2705,18 @@ class ModelTesterMixin:
else:
new_model_without_prefix(input_ids)
def test_model_is_small(self):
# Just a consistency check to make sure we are not running tests on 80M parameter models.
config, _ = self.model_tester.prepare_config_and_inputs_for_common()
# print(config)
for model_class in self.all_model_classes:
model = model_class(config)
num_params = model.num_parameters()
assert (
num_params < 1000000
), f"{model_class} is too big for the common tests ({num_params})! It should have 200k max."
global_rng = random.Random()