import sys sys.path.append("modules/preprocess") from preprocessor.SerialPreprocessor import SerialConfig, SerialPreprocessor from const import ( MULTIPLE_CHOICE_QUESTION_ANSWERING, ) from preprocessor.prompt_funcs import const_prompt_func_wrapper from preprocessor.knowledge_funcs import ( # extract_dict_knowledge_wrapper extract_dialogue_knowledge_wrapper, # None_knowledge, ) from preprocessor.label_funs import ( extract_options, ) if __name__ == "__main__": TASK = MULTIPLE_CHOICE_QUESTION_ANSWERING input_data_path = sys.argv[1] output_data_path = sys.argv[2] sort_or_not = len(sys.argv) > 3 prompt = "Generate the best choice." serial_proc = SerialPreprocessor( SerialConfig( input_data_path, output_data_path, TASK, logger_name=TASK, task_bos_token=f"[{TASK}]", prompt_func=const_prompt_func_wrapper(prompt), knowledge_func=extract_dialogue_knowledge_wrapper(": ", " | ", ", "), # knowledge_func=extract_dict_knowledge_wrapper(": ", " | "), label_func=extract_options, ) ) serial_proc.launch()