From 880dd2dc651830bd942e88172c4a764c74a7b4f6 Mon Sep 17 00:00:00 2001 From: huihun <781165206@qq.com> Date: Tue, 23 Apr 2024 10:50:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9E=B6=E6=9E=84=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E5=92=8C=E6=96=87=E4=BB=B6=E5=BA=8F=E5=88=97=E6=8E=92?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- json_feature2json.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/json_feature2json.py b/json_feature2json.py index 8e07ee4..3176280 100644 --- a/json_feature2json.py +++ b/json_feature2json.py @@ -45,7 +45,7 @@ def addr2vec(base_file_path, index): # 多线程预测bert feature_set = {} - with multiprocessing.Pool(processes=4) as pool: + with multiprocessing.Pool(processes=2) as pool: try: results = list(tqdm(pool.imap_unordered(bb2vec, [item for item in feature_json]), total=len(feature_json), @@ -94,6 +94,7 @@ if __name__ == '__main__': json_path = os.path.join(f'./out/json/{sample_type}') json_files = os.listdir(json_path) # json_files = ['1710ae16c54ac149f353ba58e752ba7069f88326e6b71107598283bd0fffcbd6.jsonl'] + json_files = sorted(json_files, key=lambda x: x[0]) json_files_len = len(json_files) now = datetime.now() formatted_now = now.strftime("%Y-%m-%d %H:%M:%S") @@ -119,10 +120,11 @@ if __name__ == '__main__': # except Exception as e: # print(e) - for index, json_file in tqdm(enumerate(json_files), + for index, json_file in tqdm(enumerate(json_files[::-1]), total=len(json_files), ascii=True, desc='Total:', - position=0): + position=0, + maxinterval=1): if os.path.isfile(os.path.join(json_path, json_file)): addr2vec(os.path.join(json_path, json_file), index)