code: def __init__(
      self,
      config: Optional[VisionTextDualEncoderConfig] = None,
      vision_model: Optional[TFPreTrainedModel] = None,
      text_model: Optional[TFPreTrainedModel] = None,
  ):
      if config is None and (
          vision_model is None or text_model is None
      ):
          raise ValueError(
              "Either a configuration or an vision and a text model has to be provided"
          )
  
      if config is None:
          config = VisionTextDualEncoderConfig.from_vision_text_configs(
              vision_model.config, text_model.config
          )
      else:
          if not isinstance(config, self.config_class):
              raise ValueError(
                  f"config: {config} has to be of type {self.config_class}"
              )
  
      # initialize with config
      super().__init__(config)
  
      if vision_model is None:
          if isinstance(config.vision_config, CLIPVisionConfig):
              vision_model = TFCLIPVisionModel.from_config(
                  config.vision_config, name="vision_model"
              )
          else:
              vision_model = TFAutoModel.from_config(
                  config.vision_config, name="vision_model"
              )
  
      if text_model is None:
          text_model = TFAutoModel.from_config(
              config.text_config, name="text_model"
          )
  
      self.vision_model = vision_model
      self.text_model = text_model
  
      # make sure that the individual model's config refers to the shared config
      # so that the updates to the config will be synced
      self.vision_model.config = self.config.vision_config
      self.text_model.config = self.config.text_config
  
      self.vision_embed_dim = config.vision_config.hidden_size
      self.text_embed_dim = config.text_config.hidden_size
      self.projection_dim = config.projection_dim
  
      self.visual_projection = Dense(
          self.projection_dim, use_bias=False, name="visual_projection"
      )
      self.text_projection = Dense(
          self.projection_dim, use_bias=False, name="text_projection"
      )
      self.logit_scale = None
      self.config = config
  
imports: from __future__ import annotations
  import re
  from typing import Optional, Tuple, Union
  import tensorflow
  from tensorflow.keras.layers import Dense
  from ...configuration_utils import PretrainedConfig
  from ...modeling_tf_utils import TFPreTrainedModel, unpack_inputs
  from ...tf_utils import shape_list
  from ...utils import DUMMY_INPUTS, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from ..auto.configuration_auto import AutoConfig
  from ..auto.modeling_tf_auto import TFAutoModel
  from ..clip.modeling_tf_clip import CLIPVisionConfig, TFCLIPOutput, TFCLIPVisionModel
  from .configuration_vision_text_dual_encoder import VisionTextDualEncoderConfig
label_desc: Use image node_id 1 to create a new TFVisionTextDualEncoderModel object from inherited base classes: TFPreTrainedModel with example: obj = TFVisionTextDualEncoderModel(config, vision_model, text_model)