code: def tf_to_pt_weight_rename(self, tf_weight):
      # Matt: The TF and PT weights don't align because our TF base classes have an extra layer compared to PT models
      # (the main model stem is in the MainLayer class). If we remove that layer, then weight names sync up as normal.
      # However, the name of that extra layer is the name of the MainLayer in the base model.
      if "vision_model" in tf_weight:
          if tf_weight.count("vision_model") == 1:
              return (
                  re.sub(
                      r"vision_model\..*?\.", "vision_model.", tf_weight
                  ),
              )
          elif tf_weight.count("vision_model") == 2:
              return (
                  re.sub(
                      r"vision_model\..*?\.vision_model",
                      "vision_model.vision_model",
                      tf_weight,
                  ),
              )
          else:
              raise ValueError(
                  f"Unexpected weight name {tf_weight}. Please file an issue on the"
                  " Transformers repo to let us know about this error!"
              )
      elif "text_model" in tf_weight:
          return (
              re.sub(r"text_model\..*?\.", "text_model.", tf_weight),
          )
      else:
          return (tf_weight,)
  
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 3 for calling the TFVisionTextDualEncoderModel obj's underlying member method code with example usage: obj.tf_to_pt_weight_rename(tf_weight) and returns: re, re, tf_weight, re