From 5d90acd466b31895d3a0fcd5c6197f17b2568e65 Mon Sep 17 00:00:00 2001 From: cyber-pioneer Date: Tue, 5 Mar 2024 06:31:32 +0000 Subject: [PATCH] fix code --- llm/predictor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llm/predictor.py b/llm/predictor.py index 4e65d4d54fc6..22a4ff1d6906 100644 --- a/llm/predictor.py +++ b/llm/predictor.py @@ -26,6 +26,7 @@ import paddle import paddle.distributed.fleet.base.topology as tp import paddle.incubate.multiprocessing as mp +from paddle.base.framework import in_pir_executor_mode from paddle.distributed import fleet from utils import ( dybatch_preprocess, @@ -360,7 +361,8 @@ def __init__(self, config: PredictorArgument, tokenizer: PretrainedTokenizer = N inference_config.disable_gpu() inference_config.disable_glog_info() inference_config.enable_new_executor() - inference_config.enable_new_ir() + if in_pir_executor_mode(): + inference_config.enable_new_ir() with static_mode_guard(): self.predictor = paddle.inference.create_predictor(inference_config)