code: def convert_to_jsonl(base_dir, split, prompt_format="QCM-LEPA"):
      split_indices = json.load(
          open(os.path.join(base_dir, "pid_splits.json"))
      )[split]
      problems = json.load(
          open(os.path.join(base_dir, "problems.json"))
      )
  
      split_problems = build_prompt_chatbot(
          problems,
          split_indices,
          prompt_format,
          use_caption=False,
          is_test=False,
      )
  
      writer = open(
          os.path.join(
              base_dir, f"scienceqa_{split}_{prompt_format}.jsonl"
          ),
          "w",
      )
      for prob_id, (input, output) in split_problems.items():
          if input.startswith("Question: "):
              input = input.replace("Question: ", "")
          if output.startswith("Answer: "):
              output = output.replace("Answer: ", "")
  
          raw_prob_data = problems[prob_id]
          if raw_prob_data["image"] is None:
              data = {
                  "id": prob_id,
                  "instruction": f"{input}",
                  "output": f"{output}",
              }
  
          else:
              data = {
                  "id": prob_id,
                  "image": os.path.join(
                      prob_id, raw_prob_data["image"]
                  ),
                  "instruction": f"{input}\n<image>",
                  "output": f"{output}",
              }
          writer.write(json.dumps(data) + "\n")
      writer.close()
  
file_path: llama-vid/scripts/convert_sqa_to_llava.py
imports: import json
  import os
  import fire
  import re
  from convert_sqa_to_llava_base_prompt import build_prompt_chatbot
label_desc: Use image node_id 2 for calling a global function with example usage: convert_to_jsonl(base_dir, split, prompt_format) without return types