code: def test_encoder_decoder_save_load_from_encoder_decoder(self):
      config = self.get_encoder_decoder_config_small()
  
      # create two random ViT/GPT2 models for vit-gpt2 & initialize weights (+cross_attention weights)
      encoder = TFViTModel(config.encoder)
      encoder(encoder.dummy_inputs)
      decoder = TFGPT2LMHeadModel(config.decoder)
      decoder(decoder.dummy_inputs)
  
      encoder_decoder_orig = TFVisionEncoderDecoderModel(
          encoder=encoder, decoder=decoder
      )
  
      pixel_values = floats_tensor(
          [
              13,
              encoder.config.num_channels,
              encoder.config.image_size,
              encoder.config.image_size,
          ]
      )
      decoder_input_ids = ids_tensor([13, 1], decoder.config.vocab_size)
  
      logits_orig = encoder_decoder_orig(
          pixel_values=pixel_values, decoder_input_ids=decoder_input_ids
      ).logits
  
      with tempfile.TemporaryDirectory() as tmp_dirname:
          encoder_path = os.path.join(tmp_dirname, "encoder")
          decoder_path = os.path.join(tmp_dirname, "decoder")
  
          encoder.save_pretrained(encoder_path)
          decoder.save_pretrained(decoder_path)
  
          encoder_decoder = TFVisionEncoderDecoderModel.from_encoder_decoder_pretrained(
              encoder_path, decoder_path
          )
  
      logits_1 = encoder_decoder(
          pixel_values=pixel_values, decoder_input_ids=decoder_input_ids
      ).logits
  
      self.assertTrue(
          logits_orig.numpy().sum() - logits_1.numpy().sum() < 1e-3
      )
  
      max_diff = np.max(np.abs(logits_1.numpy() - logits_orig.numpy()))
      self.assertAlmostEqual(max_diff, 0.0, places=4)
  
      with tempfile.TemporaryDirectory() as tmp_dirname:
          encoder_decoder.save_pretrained(tmp_dirname)
          encoder_decoder = TFVisionEncoderDecoderModel.from_pretrained(
              tmp_dirname
          )
  
      logits_2 = encoder_decoder(
          pixel_values=pixel_values, decoder_input_ids=decoder_input_ids
      ).logits
  
      max_diff = np.max(np.abs(logits_2.numpy() - logits_orig.numpy()))
      self.assertAlmostEqual(max_diff, 0.0, places=4)
  
imports: import copy
  import os
  import tempfile
  import unittest
  import numpy
  from transformers import is_tf_available, is_torch_available, is_vision_available
  from transformers.testing_utils import is_pt_tf_cross_test, require_tf, require_torch, require_vision, slow, torch_device
  from transformers.utils.generic import ModelOutput
  from ...test_modeling_tf_common import floats_tensor, ids_tensor
  from ..gpt2.test_modeling_tf_gpt2 import TFGPT2ModelTester
  from ..vit.test_modeling_tf_vit import TFViTModelTester
label_desc: Use image node_id 3 for calling the TFVisionEncoderDecoderModelSaveLoadTests obj's underlying member method code with example usage: obj.test_encoder_decoder_save_load_from_encoder_decoder() without return types