class_docstr: Text extractor
  Args:
      common_space_dim (int): common space dimension
      num_text_transformer_layers (int): number of text transformer layers
      img_feat_dim (int): image feature dimension
      txt_feat_dim (int): text feature dimension
      image_disabled (bool): image disabled
      aggregate_tokens_depth (int): aggregate tokens depth
      fusion_mode (str): feature fusion mode
class_docstr_tok: ["Text","extractor","Args",":","common_space_dim","(","int",")",":","common","space","dimension","num_text_transformer_layers","(","int",")",":","number","of","text","transformer","layers","img_feat_dim","(","int",")",":","image","feature","dimension","txt_feat_dim","(","int",")",":","text","feature","dimension","image_disabled","(","bool",")",":","image","disabled","aggregate_tokens_depth","(","int",")",":","aggregate","tokens","depth","fusion_mode","(","str",")",":","feature","fusion","mode"]
code: def __init__(
      self,
      common_space_dim,
      num_text_transformer_layers,
      img_feat_dim,
      txt_feat_dim,
      image_disabled,
      aggregate_tokens_depth,
      fusion_mode,
      text_model,
      finetune_text_model,
      image_model,
      finetune_image_model,
      max_violation=True,
      margin=0.2,
  ):
      super().__init__()
      self.aggregate_tokens_depth = aggregate_tokens_depth
      self.fusion_mode = fusion_mode
      self.image_disabled = image_disabled
      self.txt_model = TextExtractor(text_model, finetune_text_model)
      if not image_disabled:
          self.img_model = ImageExtractor(
              image_model, finetune_image_model
          )
          self.image_fc = nn.Sequential(
              nn.Linear(img_feat_dim, img_feat_dim),
              nn.Dropout(p=0.2),
              # nn.BatchNorm1d(img_feat_dim),
              nn.ReLU(),
              nn.Linear(img_feat_dim, img_feat_dim)
              # nn.BatchNorm1d(img_feat_dim)
          )
          self.process_after_concat = (
              nn.Sequential(
                  nn.Linear(
                      img_feat_dim + txt_feat_dim, common_space_dim
                  ),
                  nn.ReLU(),
                  nn.Dropout(p=0.1),
                  nn.Linear(common_space_dim, common_space_dim),
              )
              if self.fusion_mode == "concat"
              else FeatureFusion(
                  self.fusion_mode,
                  img_feat_dim,
                  txt_feat_dim,
                  common_space_dim,
              )
          )
  
      self.caption_process = TransformerPooling(
          input_dim=txt_feat_dim,
          output_dim=common_space_dim,
          num_layers=num_text_transformer_layers,
      )
      output_dim_transpooling = (
          txt_feat_dim if not image_disabled else common_space_dim
      )
      self.url_process = TransformerPooling(
          input_dim=txt_feat_dim,
          output_dim=output_dim_transpooling,
          num_layers=num_text_transformer_layers,
      )
      if self.aggregate_tokens_depth is not None:
          self.token_aggregator = DepthAggregator(
              self.aggregate_tokens_depth,
              input_dim=txt_feat_dim,
              output_dim=common_space_dim,
          )
  
      self.matching_loss = ContrastiveLoss(
          margin=margin, max_violation=max_violation
      )
  
file_path: towhee/towhee/models/mcprop/matching.py
imports: import torch
  from torch import nn
  from torch.nn import functional
  from towhee.models.mcprop.loss import ContrastiveLoss
  from towhee.models.mcprop.imageextractor import ImageExtractor
  from towhee.models.mcprop.textextractor import TextExtractor
  from towhee.models.mcprop.featurefusion import FeatureFusion
  from towhee.models.mcprop.transformerpooling import TransformerPooling
  from towhee.models.mcprop.depthaggregator import DepthAggregator
label_desc: Use image node_id 1 to create a new Matching object from inherited base classes: nn with example: obj = Matching(common_space_dim, num_text_transformer_layers, img_feat_dim, txt_feat_dim, image_disabled, aggregate_tokens_depth, fusion_mode, text_model, finetune_text_model, image_model, finetune_image_model, max_violation, margin)