From 9bcb5acab7b24f0f5722077a71217d366c12ddab Mon Sep 17 00:00:00 2001 From: HongCheng Date: Sun, 17 Mar 2024 00:17:03 +0900 Subject: [PATCH] =?UTF-8?q?Update=20zhipuai=5Fgen=5Fdata.py=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=94=9F=E6=88=90=E7=9A=84=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generate_data/zhipuai_gen_data.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/generate_data/zhipuai_gen_data.py b/generate_data/zhipuai_gen_data.py index a53a495..4370f1a 100644 --- a/generate_data/zhipuai_gen_data.py +++ b/generate_data/zhipuai_gen_data.py @@ -72,12 +72,15 @@ if __name__ == '__main__': areas_of_life = configs['areas_of_life'] ai_tool = 'zhipuai' + save_interval = 5 + total_num_each_emo_area = 5 + conversation_lis = [] for area in areas_of_life: for emo in emotions_lis: gen_path = f'./{ai_tool}/{area}/{emo}.jsonl' - for i in tqdm(range(100), desc='{emo}, {area}'.format(emo=emo, area=area)): + for i in tqdm(range(total_num_each_emo_area), desc='{emo}, {area}'.format(emo=emo, area=area)): res = zhipu_api(area, emo) print(res) if res == 'null': @@ -85,7 +88,7 @@ if __name__ == '__main__': continue conversation_lis.append(convert(res)) - if ((i+1) % 10 == 0): + if ((i+1) % save_interval == 0): # path = f'./{args.data}.jsonl' save_jsonl(data_lis=conversation_lis, file_path=gen_path) print(f'generate {gen_path}')