code: def load_gt_file(file_path):
      if is_url(file_path):
          file_path = cache_url(
              file_path, registry.get_path("cache_root")
          )
      data = []
      if any(ext in file_path for ext in ["csv", "tsv"]):
          df = pd.read_csv(file_path)
          data.extend(df.to_dict(orient="records"))
  
      elif "jsonl" in file_path:
          with open(file_path, "r") as f:
              data.extend([json.loads(line) for line in f])
      else:
          with open(file_path, "r") as f:
              loaded = json.load(f)
              if isinstance(loaded, list):
                  data.extend(loaded)
              elif isinstance(loaded, dict):
                  # assume that loaded data in file  is the corresponding caption to the key
                  data.extend(
                      [
                          {"sample_id": k, **v}
                          if isinstance(v, dict)
                          else {"sample_id": k, "caption": v}
                          for k, v in loaded.items()
                      ]
                  )
      return data
  
imports: import json
  import os
  import pandas
  from tqdm import tqdm
  from lavis.common.dist_utils import main_process, get_rank
  from lavis.common.registry import registry
  from lavis.tasks.base_task import BaseTask
  from lavis.common.utils import is_convertible_to_int, is_url, cache_url
  from pycocoevalcap.eval import COCOEvalCap
  from pycocotools.coco import COCO
  from torchvision.datasets.utils import download_url
label_desc: Use image node_id 1 for calling a global function with example usage: load_gt_file(file_path) and returns: data