code: def format_for_prediction(self, report):
      captions = report.captions.tolist()
      predictions = []
      remove_unk_from_caption_prediction = getattr(
          self.config, "remove_unk_from_caption_prediction", False
      )
  
      for idx, image_id in enumerate(report.image_id):
          image_id = byte_tensor_to_object(image_id)
          caption = self.caption_processor(captions[idx])["caption"]
          if remove_unk_from_caption_prediction:
              caption = caption.replace("<unk>", "")
              caption = caption.replace("  ", " ").strip()
          if isinstance(image_id, torch.Tensor):
              image_id = image_id.item()
          predictions.append({"image_id": image_id, "caption": caption})
  
      return predictions
  
file_path: mmf/mmf/datasets/builders/coco/dataset.py
imports: import torch
  from mmf.common.sample import Sample
  from mmf.datasets.builders.vqa2 import VQA2Dataset
  from mmf.utils.distributed import byte_tensor_to_object, object_to_byte_tensor
label_desc: Use image node_id 5 for calling the COCODataset obj's underlying member method code with example usage: obj.format_for_prediction(report) and returns: predictions