"src/git@developer.sourcefind.cn:OpenDAS/nni.git" did not exist on "378435584ead2780e17af4ec1ed3353543e85ccb"
Unverified Commit 3441ad7d authored by Yih-Dar's avatar Yih-Dar Committed by GitHub
Browse files

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



* fix

* fix

* fix

---------
Co-authored-by: default avatarydshieh <ydshieh@users.noreply.github.com>
parent 78a2b19f
...@@ -341,7 +341,7 @@ class TFModelTesterMixin: ...@@ -341,7 +341,7 @@ class TFModelTesterMixin:
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() 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 = model_class(config)
model.build() model.build()
...@@ -689,7 +689,7 @@ class TFModelTesterMixin: ...@@ -689,7 +689,7 @@ class TFModelTesterMixin:
def test_compile_tf_model(self): def test_compile_tf_model(self):
config, _ = self.model_tester.prepare_config_and_inputs_for_common() 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 # Prepare our model
model = model_class(config) model = model_class(config)
# These are maximally general inputs for the model, with multiple None dimensions # These are maximally general inputs for the model, with multiple None dimensions
......
...@@ -111,7 +111,7 @@ class TFCoreModelTesterMixin: ...@@ -111,7 +111,7 @@ class TFCoreModelTesterMixin:
@slow @slow
def test_graph_mode(self): def test_graph_mode(self):
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() 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) inputs = self._prepare_for_class(inputs_dict, model_class)
model = model_class(config) model = model_class(config)
...@@ -125,7 +125,7 @@ class TFCoreModelTesterMixin: ...@@ -125,7 +125,7 @@ class TFCoreModelTesterMixin:
@slow @slow
def test_xla_mode(self): def test_xla_mode(self):
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() 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) inputs = self._prepare_for_class(inputs_dict, model_class)
model = model_class(config) model = model_class(config)
...@@ -140,7 +140,7 @@ class TFCoreModelTesterMixin: ...@@ -140,7 +140,7 @@ class TFCoreModelTesterMixin:
def test_xla_fit(self): def test_xla_fit(self):
# This is a copy of the test_keras_fit method, but we use XLA compilation instead of eager # 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() 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 = model_class(config)
if getattr(model, "hf_compute_loss", None): if getattr(model, "hf_compute_loss", None):
# Test that model correctly compute the loss with kwargs # Test that model correctly compute the loss with kwargs
...@@ -214,7 +214,7 @@ class TFCoreModelTesterMixin: ...@@ -214,7 +214,7 @@ class TFCoreModelTesterMixin:
encoder_seq_length = getattr(self.model_tester, "encoder_seq_length", self.model_tester.seq_length) 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) 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) class_inputs_dict = self._prepare_for_class(inputs_dict, model_class)
model = model_class(config) model = model_class(config)
model.build() model.build()
...@@ -269,7 +269,7 @@ class TFCoreModelTesterMixin: ...@@ -269,7 +269,7 @@ class TFCoreModelTesterMixin:
# try/finally block to ensure subsequent tests run in float32 # try/finally block to ensure subsequent tests run in float32
try: try:
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() 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) class_inputs_dict = self._prepare_for_class(inputs_dict, model_class)
model = model_class(config) model = model_class(config)
outputs = model(class_inputs_dict) outputs = model(class_inputs_dict)
...@@ -352,7 +352,7 @@ class TFCoreModelTesterMixin: ...@@ -352,7 +352,7 @@ class TFCoreModelTesterMixin:
def test_graph_mode_with_inputs_embeds(self): def test_graph_mode_with_inputs_embeds(self):
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() 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 = model_class(config)
inputs = copy.deepcopy(inputs_dict) inputs = copy.deepcopy(inputs_dict)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment