class_docstr: CLIP4Clip model from the paper: https://arxiv.org/abs/2104.08860
  Only meanP and 2d type reserved because of its performance.
  Args:
      embed_dim (`int`):
          Embedding dimension.
      image_resolution (`int`):
          Image resolution.
      vision_layers (`int`):
          Number of layers for vision.
      vision_width (`int`):
          Width for vision.
      vision_patch_size (`int`):
          Patch size for vision.
      context_length (`int`):
          Length of context.
      vocab_size (`int`):
          Vocabulary size.
      transformer_width (`int`):
          Width for transformer.
      transformer_heads (`int`):
          Number of heads for transformer.
      transformer_layers (`int`):
          Number of layers for transformer size.
class_docstr_tok: ["CLIP4Clip","model","from","the","paper",":","https",":","\/\/arxiv.org\/abs\/2104.08860","Only","meanP","and","2d","type","reserved","because","of","its","performance",".","Args",":","embed_dim","(","`","int","`",")",":","Embedding","dimension",".","image_resolution","(","`","int","`",")",":","Image","resolution",".","vision_layers","(","`","int","`",")",":","Number","of","layers","for","vision",".","vision_width","(","`","int","`",")",":","Width","for","vision",".","vision_patch_size","(","`","int","`",")",":","Patch","size","for","vision",".","context_length","(","`","int","`",")",":","Length","of","context",".","vocab_size","(","`","int","`",")",":","Vocabulary","size",".","transformer_width","(","`","int","`",")",":","Width","for","transformer",".","transformer_heads","(","`","int","`",")",":","Number","of","heads","for","transformer",".","transformer_layers","(","`","int","`",")",":","Number","of","layers","for","transformer","size","."]
code: def __init__(
      self,
      embed_dim: int,
      image_resolution: int,
      vision_layers: int,
      vision_width: int,
      vision_patch_size: int,
      context_length: int,
      vocab_size: int,
      transformer_width: int,
      transformer_heads: int,
      transformer_layers: int,
  ):
      super().__init__()
      self.ignore_video_index = -1
      self.loose_type = True
      self.linear_patch = "2d"
      self.clip = CLIP(
          embed_dim=embed_dim,
          image_resolution=image_resolution,
          vision_layers=vision_layers,
          vision_width=vision_width,
          vision_patch_size=vision_patch_size,
          context_length=context_length,
          vocab_size=vocab_size,
          transformer_width=transformer_width,
          transformer_heads=transformer_heads,
          transformer_layers=transformer_layers,
          clip4clip=True,
      ).float()
      self.sim_header = "meanP"
      self.loss_fct = CrossEn()
      self.apply(self.init_weights)
  
imports: import torch
  import logging
  from typing import Union
  from torch import nn
  from towhee.models.clip4clip.until_module import PreTrainedModel, CrossEn
  from towhee.models.clip import CLIP, get_configs
label_desc: Use image node_id 1 to create a new CLIP4Clip object from inherited base classes: CLIP4ClipPreTrainedModel with example: obj = CLIP4Clip(embed_dim, image_resolution, vision_layers, vision_width, vision_patch_size, context_length, vocab_size, transformer_width, transformer_heads, transformer_layers)