class_docstr: forward function for MFM and MLM.
code: def forward(
      self,
      caps,
      cmasks,
      vfeats,
      vmasks,
      attention_mask=None,
      video_label=None,
      text_label=None,
      **kwargs,
  ):
      output_hidden_states = False if self.is_train else True
  
      target_vfeats, non_masked_frame_mask = None, None
      if video_label is not None:
          target_vfeats = vfeats.masked_select(
              video_label.unsqueeze(-1)
          ).view(-1, vfeats.size(-1))
          # mask video token.
          vfeats[video_label] = 0.0
          non_masked_frame_mask = vmasks.clone()
          non_masked_frame_mask[video_label] = False
  
      attention_mask, token_type_ids = self._mm_on_the_fly(
          cmasks, vmasks, attention_mask
      )
  
      outputs = self.mm_encoder(
          input_ids=caps,
          input_video_embeds=vfeats,
          attention_mask=attention_mask,
          token_type_ids=token_type_ids,
          masked_frame_labels=video_label,
          target_video_hidden_states=target_vfeats,
          non_masked_frame_mask=non_masked_frame_mask,
          masked_lm_labels=text_label,
          output_hidden_states=output_hidden_states,
      )
  
      video_logits, text_logits = outputs[0], outputs[1]
  
      if self.is_train:  # return earlier for training.
          return {
              "video_logits": video_logits,
              "text_logits": text_logits,
          }
  
      pooled_video, pooled_text = self._pooling_vt_layer(
          outputs[2], cmasks, vmasks
      )
      return {"pooled_video": pooled_video, "pooled_text": pooled_text}
  
imports: import torch
  from torch import nn
  from .None import transformermodel
label_desc: Use image node_id 1 for calling the MMFusionMFMMLM obj's underlying member method code with example usage: obj.forward(caps, cmasks, vfeats, vmasks, attention_mask, video_label, text_label) and returns: dict, dict