丁云鹏 4 ヶ月 前
コミット
83ef2a54be

+ 1 - 3
recommend-model-produce/src/main/python/tools/static_ps_infer_v2.py

@@ -316,8 +316,7 @@ class Main(object):
         output_file = os.path.join(output_dir, f"epoch_{epoch}_results.jsonl")
         
         # 创建处理器实例
-        fetch_handler = InferenceFetchHandler(output_file)
-        fetch_handler.set_var_dict(fetch_vars)
+        fetch_handler = FetchHandler(var_dict=fetch_vars, period_secs=1)
         print(paddle.static.default_main_program()._fleet_opt)
         self.exe.infer_from_dataset(
             program=paddle.static.default_main_program(),
@@ -327,7 +326,6 @@ class Main(object):
             print_period=print_step,
             debug=debug,
             fetch_handler=fetch_handler)
-        fetch_handler.finish()