class_docstr: VisualPrompt
  
  Args:
      - sim_head (`int`):
          Sim head type, must be in ['meanP', 'LSTM', 'Transf', 'Conv_1D', 'Transf_cls'].
      - clip_state_dict (`int`):
          Clip model state dict.
      - num_frames (`int`):
          Number of frame.
class_docstr_tok: ["VisualPrompt","Args",":","-","sim_head","(","`","int","`",")",":","Sim","head","type",",","must","be","in","[","'meanP","'",",","'LSTM","'",",","'Transf","'",",","'Conv_1D","'",",","'Transf_cls","'","]",".","-","clip_state_dict","(","`","int","`",")",":","Clip","model","state","dict",".","-","num_frames","(","`","int","`",")",":","Number","of","frame","."]
code: def __init__(
      self, sim_head: str, clip_state_dict: dict, num_frames: int
  ):
      super().__init__()
      self.sim_header = sim_head
      self.num_frames = num_frames
      assert sim_head in [
          "meanP",
          "LSTM",
          "Transf",
          "Conv_1D",
          "Transf_cls",
      ]
  
      if (
          self.sim_header == "LSTM"
          or self.sim_header == "Transf"
          or self.sim_header == "Transf_cls"
          or self.sim_header == "Conv_1D"
      ):
          embed_dim = clip_state_dict["text_projection"].shape[1]
  
          context_length = clip_state_dict[
              "positional_embedding"
          ].shape[0]
          # vocab_size = clip_state_dict['token_embedding.weight'].shape[0]
          transformer_width = clip_state_dict["ln_final.weight"].shape[
              0
          ]
          transformer_heads = transformer_width // 64
  
          # transformer_layers = len(
          #     set(k.split('.')[2] for k in clip_state_dict if k.startswith('transformer.resblocks')))
  
          self.frame_position_embeddings = nn.Embedding(
              context_length, embed_dim
          )
      if self.sim_header == "Transf":
          self.transformer = TemporalTransformer(
              width=embed_dim, layers=6, heads=transformer_heads
          )
      if self.sim_header == "LSTM":
          self.lstm_visual = nn.LSTM(
              input_size=embed_dim,
              hidden_size=embed_dim,
              batch_first=True,
              bidirectional=False,
              num_layers=1,
          )
  
      self.apply(init_vit_weights)
  
      if self.sim_header == "Transf_cls":
          self.transformer = TAggregate(
              clip_length=self.num_frames,
              embed_dim=embed_dim,
              n_layers=6,
          )
  
      if self.sim_header == "Conv_1D":
          self.shift = nn.Conv1d(
              embed_dim,
              embed_dim,
              3,
              padding=1,
              groups=embed_dim,
              bias=False,
          )
          weight = torch.zeros(embed_dim, 1, 3)
          weight[: embed_dim // 4, 0, 0] = 1.0
          weight[
              embed_dim // 4 : embed_dim // 4 + embed_dim // 2, 0, 1
          ] = 1.0
          weight[-embed_dim // 4 :, 0, 2] = 1.0
          self.shift.weight = nn.Parameter(weight)
  
imports: import torch
  from torch import nn
  from collections import OrderedDict
  from towhee.models.utils.weight_init import trunc_normal_
  from towhee.models.utils.init_vit_weights import init_vit_weights
label_desc: Use image node_id 1 to create a new VisualPrompt object from inherited base classes: nn with example: obj = VisualPrompt(sim_head, clip_state_dict, num_frames)