utils.data_utils

Utils for data load, save, and process (e.g., prompt construction)

Functions

get_multi_choice_info(options)

Given the list of options for multiple choice question

save_jsonl(filename, data)

Save a dictionary of data to a JSON Lines file with the filename as key and caption as value.

Module Contents

utils.data_utils.get_multi_choice_info(options)[source]

Given the list of options for multiple choice question Return the index2ans and all_choices.

utils.data_utils.save_jsonl(filename, data)[source]

Save a dictionary of data to a JSON Lines file with the filename as key and caption as value.

Parameters:
  • filename (str) – The path to the file where the data should be saved.

  • data (dict) – The dictionary containing the data to save where key is the image path and value is the caption.