code: def format_for_prediction(self, report):
      scores = torch.sigmoid(report.scores)
      binary_scores = scores > self.prediction_threshold
      predictions = []
  
      for idx, item_id in enumerate(report.id):
          item_id = byte_tensor_to_object(item_id)
          score = binary_scores[idx]
          labels = []
          score = score.nonzero(as_tuple=False)
          for item in score:
              labels.append(self.idx_to_class[item.item()])
          predictions.append({"id": item_id, "labels": labels})
  
      return predictions
  
imports: import os
  import PIL
  import torch
  from mmf.common.sample import Sample
  from mmf.datasets.base_dataset import BaseDataset
  from mmf.datasets.builders.charades._utils import CharadesVideoClips, img2gif, make_charades_df
  from mmf.utils.distributed import byte_tensor_to_object, object_to_byte_tensor
  from mmf.utils.file_io import PathManager
label_desc: Use image node_id 8 for calling the CharadesDataset obj's underlying member method code with example usage: obj.format_for_prediction(report) and returns: predictions