code: def convert_to_coco_gt(
      data, outpath_questions, outpath_annotations, split, sample_id_key
  ):
      if split not in data:
          return
      questions_data = {
          "info": "",
          "task_type": "",
          "data_type": "",
          "license": "",
          "data_subtype": "",
          "questions": [],
      }
      annotations_data = {
          "info": "",
          "task_type": "",
          "data_type": "",
          "license": "",
          "data_subtype": "",
          "annotations": [],
      }
      print("Generating ground truth annotations...")
      for ann in tqdm(data[split]):
          if ann == None:
              continue
          # if ann[sample_id_key] not in img_ids:
          #     continue
          ques_id = ann["question_id"]
          ques_id = (
              int(ques_id.item())
              if isinstance(ques_id, torch.Tensor)
              else ques_id
          )
          if ques_id != int and is_convertible_to_int(ques_id):
              ques_id = int(ques_id)
          questions_data["questions"].append(
              {
                  "question": ann["text_input"],
                  "image_id": ann[sample_id_key],
                  "question_id": ques_id,
              }
          )
          annotations_data["annotations"].append(
              {
                  "question_type": ""
                  if "question_type" not in ann
                  else ann["question_type"],
                  "multiple_choice_answer": ann["answers"][0]
                  if isinstance(ann["answers"], list)
                  else ann["answers"],
                  "answers": [
                      {"answer": ans, "answer_id": i}
                      for i, ans in enumerate(ann["answers"])
                  ]
                  if isinstance(ann["answers"], list)
                  else [{"answer": ann["answers"], "answer_id": 0}],
                  "image_id": ann[sample_id_key],
                  "question_id": ques_id,
                  "answer_type": ""
                  if "answer_type" not in ann
                  else ann["answer_type"],
              }
          )
  
      json.dump(questions_data, open(outpath_questions, "w"))
      print(f"Saved questions data at {outpath_questions}")
      json.dump(annotations_data, open(outpath_annotations, "w"))
      print(f"Saved annotation data at {outpath_annotations}")
  
imports: import logging
  import json
  import os
  import torch
  from tqdm import tqdm
  from lavis.common.utils import is_convertible_to_int
  import lavis.common.dist_utils
  from lavis.common.registry import registry
  from lavis.common.vqa_tools.vqa import VQA
  from lavis.common.vqa_tools.vqa_eval import VQAEval
  from lavis.tasks.base_task import BaseTask
label_desc: Use image node_id 1 for calling a global function with example usage: convert_to_coco_gt(data, outpath_questions, outpath_annotations, split, sample_id_key) without return types