Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make (TF) CI faster (test only a random subset of model classes) #24592

Merged
merged 3 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/test_modeling_tf_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def test_onnx_runtime_optimize(self):

config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()

for model_class in self.all_model_classes:
for model_class in self.all_model_classes[:2]:
model = model_class(config)
model.build()

Expand Down Expand Up @@ -689,7 +689,7 @@ def test_pt_tf_model_equivalence(self, allow_missing_keys=False):
def test_compile_tf_model(self):
config, _ = self.model_tester.prepare_config_and_inputs_for_common()

for model_class in self.all_model_classes:
for model_class in self.all_model_classes[:2]:
# Prepare our model
model = model_class(config)
# These are maximally general inputs for the model, with multiple None dimensions
Expand Down
12 changes: 6 additions & 6 deletions tests/utils/test_modeling_tf_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _prepare_for_class(self, inputs_dict, model_class, return_labels=False) -> d
@slow
def test_graph_mode(self):
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
for model_class in self.all_model_classes:
for model_class in self.all_model_classes[:2]:
inputs = self._prepare_for_class(inputs_dict, model_class)
model = model_class(config)

Expand All @@ -125,7 +125,7 @@ def run_in_graph_mode():
@slow
def test_xla_mode(self):
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
for model_class in self.all_model_classes:
for model_class in self.all_model_classes[:2]:
inputs = self._prepare_for_class(inputs_dict, model_class)
model = model_class(config)

Expand All @@ -140,7 +140,7 @@ def run_in_graph_mode():
def test_xla_fit(self):
# This is a copy of the test_keras_fit method, but we use XLA compilation instead of eager
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
for model_class in self.all_model_classes:
for model_class in self.all_model_classes[:2]:
model = model_class(config)
if getattr(model, "hf_compute_loss", None):
# Test that model correctly compute the loss with kwargs
Expand Down Expand Up @@ -214,7 +214,7 @@ def test_saved_model_creation_extended(self):
encoder_seq_length = getattr(self.model_tester, "encoder_seq_length", self.model_tester.seq_length)
encoder_key_length = getattr(self.model_tester, "key_length", encoder_seq_length)

for model_class in self.all_model_classes:
for model_class in self.all_model_classes[:2]:
class_inputs_dict = self._prepare_for_class(inputs_dict, model_class)
model = model_class(config)
model.build()
Expand Down Expand Up @@ -269,7 +269,7 @@ def test_mixed_precision(self):
# try/finally block to ensure subsequent tests run in float32
try:
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
for model_class in self.all_model_classes:
for model_class in self.all_model_classes[:2]:
class_inputs_dict = self._prepare_for_class(inputs_dict, model_class)
model = model_class(config)
outputs = model(class_inputs_dict)
Expand Down Expand Up @@ -352,7 +352,7 @@ def test_train_pipeline_custom_model(self):
def test_graph_mode_with_inputs_embeds(self):
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()

for model_class in self.all_model_classes:
for model_class in self.all_model_classes[:2]:
model = model_class(config)

inputs = copy.deepcopy(inputs_dict)
Expand Down