[tests] remove pt_tf equivalence tests (#36253)
This commit is contained in:
@@ -270,22 +270,6 @@ class TFViTMAEModelTest(TFModelTesterMixin, PipelineTesterMixin, unittest.TestCa
|
||||
output_for_kw_input = model(**inputs_np, noise=noise)
|
||||
self.assert_outputs_same(output_for_dict_input, output_for_kw_input)
|
||||
|
||||
# overwrite from common since TFViTMAEForPretraining has random masking, we need to fix the noise
|
||||
# to generate masks during test
|
||||
def check_pt_tf_models(self, tf_model, pt_model, tf_inputs_dict):
|
||||
# make masks reproducible
|
||||
np.random.seed(2)
|
||||
|
||||
num_patches = int((tf_model.config.image_size // tf_model.config.patch_size) ** 2)
|
||||
noise = np.random.uniform(size=(self.model_tester.batch_size, num_patches))
|
||||
tf_noise = tf.constant(noise)
|
||||
|
||||
# Add `noise` argument.
|
||||
# PT inputs will be prepared in `super().check_pt_tf_models()` with this added `noise` argument
|
||||
tf_inputs_dict["noise"] = tf_noise
|
||||
|
||||
super().check_pt_tf_models(tf_model, pt_model, tf_inputs_dict)
|
||||
|
||||
# overwrite from common since TFViTMAEForPretraining has random masking, we need to fix the noise
|
||||
# to generate masks during test
|
||||
def test_keras_save_load(self):
|
||||
|
||||
@@ -204,22 +204,6 @@ class ViTMAEModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
|
||||
config_and_inputs = self.model_tester.prepare_config_and_inputs()
|
||||
self.model_tester.create_and_check_for_pretraining(*config_and_inputs)
|
||||
|
||||
# overwrite from common since ViTMAEForPretraining has random masking, we need to fix the noise
|
||||
# to generate masks during test
|
||||
def check_pt_tf_models(self, tf_model, pt_model, pt_inputs_dict):
|
||||
# make masks reproducible
|
||||
np.random.seed(2)
|
||||
|
||||
num_patches = int((pt_model.config.image_size // pt_model.config.patch_size) ** 2)
|
||||
noise = np.random.uniform(size=(self.model_tester.batch_size, num_patches))
|
||||
pt_noise = torch.from_numpy(noise)
|
||||
|
||||
# Add `noise` argument.
|
||||
# PT inputs will be prepared in `super().check_pt_tf_models()` with this added `noise` argument
|
||||
pt_inputs_dict["noise"] = pt_noise
|
||||
|
||||
super().check_pt_tf_models(tf_model, pt_model, pt_inputs_dict)
|
||||
|
||||
def test_save_load(self):
|
||||
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user