Skip to content

Commit

Permalink
Make (TF) CI faster (test only a subset of model classes) (#24592)
Browse files Browse the repository at this point in the history
* fix

* fix

* fix

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
  • Loading branch information
ydshieh and ydshieh authored Jun 30, 2023
1 parent 78a2b19 commit 3441ad7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
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

0 comments on commit 3441ad7

Please sign in to comment.