code: def generate(
      self,
      caps,
      cmasks,
      vfeats,
      vmasks,
      attention_mask=None,
      bos_token_id=None,
      eos_token_id=None,
      **kwargs,
  ):
      # a simplified interface from
      # https://huggingface.co/transformers/v3.4.0/_modules/transformers/generation_utils.html#GenerationMixin.generate
  
      # caps now only have
      # [CLS], [SEP] (for video) and [CLS] (as bos_token)
      assert caps.size(1) == 3
  
      attention_mask, token_type_ids = self._mm_on_the_fly(
          cmasks, vmasks, attention_mask
      )
  
      output = self.mm_encoder.generate(
          input_ids=caps,
          input_video_embeds=vfeats,
          attention_mask=attention_mask,
          token_type_ids=token_type_ids,
          bos_token_id=bos_token_id,
          eos_token_id=eos_token_id,
          max_length=self.max_length,
          **self.gen_param,
      )
      return output
  
file_path: fairseq/examples/MMPT/mmpt/models/mmfusionnlg.py
imports: import torch
  from torch.nn import functional
  from typing import Optional, Iterable
  from .mmfusion import MMFusion
  from .transformermodel import MMBertModel
  from ..modules import VideoTokenMLP
label_desc: Use image node_id 3 for calling the MMFusionNLG obj's underlying member method code with example usage: obj.generate(caps, cmasks, vfeats, vmasks, attention_mask, bos_token_id, eos_token_id) and returns: output