Revert "Experimenting with adding proper get_config() and from_config() methods (#14361)"

This reverts commit e99a2314cd.
This commit is contained in:
Matt
2021-11-11 14:21:50 +00:00
committed by Lysandre
parent 527c763ff6
commit a5211fc59b
2 changed files with 0 additions and 21 deletions

View File

@@ -692,13 +692,6 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin, TFGenerationMixin, Pu
self.config = config self.config = config
self.name_or_path = config.name_or_path self.name_or_path = config.name_or_path
def get_config(self):
return self.config
@classmethod
def from_config(cls, config, **kwargs):
return cls._from_config(config, **kwargs)
@classmethod @classmethod
def _from_config(cls, config, **kwargs): def _from_config(cls, config, **kwargs):
""" """

View File

@@ -160,20 +160,6 @@ class TFModelTesterMixin:
self.assert_outputs_same(after_outputs, outputs) self.assert_outputs_same(after_outputs, outputs)
def test_save_load_config(self):
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
for model_class in self.all_model_classes:
model = model_class(config)
outputs = model(self._prepare_for_class(inputs_dict, model_class))
new_model = model_class.from_config(model.get_config())
_ = new_model(self._prepare_for_class(inputs_dict, model_class)) # Build model
new_model.set_weights(model.get_weights())
after_outputs = new_model(self._prepare_for_class(inputs_dict, model_class))
self.assert_outputs_same(after_outputs, outputs)
@tooslow @tooslow
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()