import sys sys.path.append("modules/preprocess") from preprocessor.SerialPreprocessor import SerialConfig, SerialPreprocessor from const import ( DIALOGUE_STATE_TRACKING, ) from preprocessor.prompt_funcs import const_prompt_func_wrapper from preprocessor.knowledge_funcs import None_knowledge, extract_turn_domains_wrapper from preprocessor.label_funs import ( extract_belief_state_wrapper, ) import os, shutil if __name__ == "__main__": TASK = DIALOGUE_STATE_TRACKING 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( "Generate the dialogue state based on the given dialogue context." ), knowledge_func=None_knowledge, label_func=extract_belief_state_wrapper(", ", " | ", "; ", ": "), roles_to_build_example=[["USER"]], ) ) serial_proc.launch() for split in ["train", "dev", "test"]: if os.path.isfile(os.path.join(input_data_path, f"{split}_ontology.json")): shutil.copyfile( os.path.join(input_data_path, f"{split}_ontology.json"), os.path.join(output_data_path, f"{split}_ontology.json"), )