code: def test_saved_model_creation_extended(self):
      (
          config,
          inputs_dict,
      ) = self.model_tester.prepare_config_and_inputs_for_common()
      config.output_hidden_states = True
      config.output_attentions = True
  
      if hasattr(config, "use_cache"):
          config.use_cache = True
  
      for model_class in self.all_model_classes:
          class_inputs_dict = self._prepare_for_class(
              inputs_dict, model_class
          )
          model = model_class(config)
          num_out = len(model(class_inputs_dict))
  
          with tempfile.TemporaryDirectory() as tmpdirname:
              model.save_pretrained(tmpdirname, saved_model=True)
              saved_model_dir = os.path.join(
                  tmpdirname, "saved_model", "1"
              )
              model = tf.keras.models.load_model(saved_model_dir)
              outputs = model(class_inputs_dict)
              output_hidden_states = outputs["hidden_states"]
              output_attentions = outputs["attentions"]
  
              # Check number of outputs
              self.assertEqual(len(outputs), num_out)
  
              # Check number of layers
              expected_num_layers = getattr(
                  self.model_tester,
                  "expected_num_hidden_layers",
                  self.model_tester.num_hidden_layers + 1,
              )
  
              # Check hidden states
              self.assertEqual(
                  len(output_hidden_states), expected_num_layers
              )
              self.assertListEqual(
                  list(output_hidden_states[0].shape[-2:]),
                  [
                      self.model_tester.seq_length,
                      self.model_tester.hidden_size,
                  ],
              )
  
              # Check attention outputs
              self.assertEqual(
                  len(output_attentions),
                  self.model_tester.num_hidden_layers,
              )
  
              seq_length = self.model_tester.seq_length
              key_length = getattr(
                  self.model_tester, "key_length", seq_length
              )
  
              self.assertListEqual(
                  list(output_attentions[0].shape[-3:]),
                  [
                      self.model_tester.num_attention_heads,
                      seq_length,
                      key_length,
                  ],
              )
  
imports: import inspect
  import os
  import tempfile
  import unittest
  from importlib import import_module
  import requests
  from transformers import CLIPConfig, CLIPTextConfig, CLIPVisionConfig
  from transformers.testing_utils import require_tf, require_vision, slow
  from transformers.utils import is_tf_available, is_vision_available
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask
label_desc: Use image node_id 6 for calling the TFCLIPTextModelTest obj's underlying member method code with example usage: obj.test_saved_model_creation_extended() without return types