code: def format_for_prediction(self, report):
      answer_processor = self.answer_processor
  
      batch_size = len(report.question_id)
      pred_answers = report.scores.argmax(dim=-1).view(batch_size, -1)
      answer_space_size = answer_processor.get_true_vocab_size()
  
      image_ids = report.image_id.cpu().numpy()
      context_tokens = report.context_tokens.cpu().numpy()
      predictions = []
      for idx, question_id in enumerate(report.question_id):
          # collect VQA answers
          image_id = byte_tensor_to_object(image_ids[idx])
          tokens = byte_tensor_to_object(context_tokens[idx])
          answer_words = []
          pred_source = []
          for answer_id in pred_answers[idx].tolist():
              if answer_id >= answer_space_size:
                  answer_id -= answer_space_size
                  answer_words.append(word_tokenize(tokens[answer_id]))
                  pred_source.append("OCR")
              else:
                  if answer_id == answer_processor.EOS_IDX:
                      break
                  answer_words.append(
                      answer_processor.answer_vocab.idx2word(answer_id)
                  )
                  pred_source.append("VOCAB")
          # join all the answer tokens with space
          # (this should be correct for almost all cases)
          pred_answer = " ".join(answer_words).replace(" 's", "'s")
          entry = {
              "question_id": question_id.item(),
              "image_id": image_id,
              "answer": pred_answer,
              "pred_source": pred_source,
          }
          entry = self.postprocess_evalai_entry(entry)
  
          predictions.append(entry)
  
      return predictions
  
file_path: mmf/mmf/datasets/builders/textvqa/dataset.py
imports: import numpy
  import torch
  from mmf.common.sample import Sample
  from mmf.datasets.mmf_dataset import MMFDataset
  from mmf.utils.distributed import byte_tensor_to_object, object_to_byte_tensor
  from mmf.utils.text import word_tokenize
label_desc: Use image node_id 4 for calling the TextVQADataset obj's underlying member method code with example usage: obj.format_for_prediction(report) and returns: predictions