MCPcopy Create free account
hub / github.com/Felixgithub2017/MMCU / main

Function main

TestChatGLM.py:146–168  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

144 return preds
145
146def main(args):
147 subjects = sorted([f.split(".xlsx")[0] for f in os.listdir(os.path.join(args.data_dir, "test")) if ".xlsx" in f])
148 if not os.path.exists(args.save_dir):
149 os.mkdir(args.save_dir)
150
151 print("subjects:", subjects)
152 print("args", args)
153
154 for subject in subjects:
155 if subject != "医疗":
156 dev_df = pd.read_excel(os.path.join(args.data_dir, "dev", subject + ".xlsx"), header=0)[:args.ntrain]
157 test_df = pd.read_excel(os.path.join(args.data_dir, "test", subject + ".xlsx"), header=0)
158 preds = eval(args, subject, dev_df, test_df)
159 writelines_to_file(os.path.join(args.save_dir, subject), preds)
160
161 else:
162 dev_df = pd.read_excel(os.path.join(args.data_dir, "dev", subject + ".xlsx"), header=0)[:args.ntrain]
163 f = pd.ExcelFile(os.path.join(args.data_dir, "test", subject + ".xlsx"))
164 sheet_list = f.sheet_names
165 for sheet in sheet_list:
166 test_df = pd.read_excel(os.path.join(args.data_dir, "test", subject + ".xlsx"), header=0, sheet_name=sheet)
167 preds = eval(args, sheet, dev_df, test_df)
168 writelines_to_file(os.path.join(args.save_dir, sheet), preds)
169
170if __name__ == "__main__":
171 parser = argparse.ArgumentParser()

Callers 1

TestChatGLM.pyFile · 0.70

Calls 2

evalFunction · 0.70
writelines_to_fileFunction · 0.70

Tested by

no test coverage detected