| import sys | |
| sys.path.append("modules/preprocess") | |
| from preprocessor.SerialPreprocessor import SerialConfig, SerialPreprocessor | |
| from const import MACHINE_READING_COMPREHENSION, MULTI_REF_SEP | |
| from preprocessor.prompt_funcs import const_prompt_func_wrapper | |
| from preprocessor.knowledge_funcs import extract_dialogue_knowledge_wrapper | |
| from preprocessor.label_funs import ( | |
| extract_turn_utterance, | |
| ) | |
| if __name__ == "__main__": | |
| TASK = MACHINE_READING_COMPREHENSION | |
| input_data_path = sys.argv[1] | |
| output_data_path = sys.argv[2] | |
| 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( | |
| "Answer the question based on the given document and dialogue context." | |
| ), | |
| knowledge_func=extract_dialogue_knowledge_wrapper(": ", " | ", ", "), | |
| label_func=extract_turn_utterance, | |
| roles_in_history=[["USER"]], | |
| roles_to_build_example=[["SYSTEM"]], | |
| multi_ref_sep=MULTI_REF_SEP, | |
| ) | |
| ) | |
| serial_proc.launch() | |