diff --git a/paddlex/inference/components/paddle_predictor/predictor.py b/paddlex/inference/components/paddle_predictor/predictor.py index 365aab16c..9656ada61 100644 --- a/paddlex/inference/components/paddle_predictor/predictor.py +++ b/paddlex/inference/components/paddle_predictor/predictor.py @@ -176,12 +176,14 @@ def _create(self): config.set_cpu_math_library_num_threads(self.option.cpu_threads) - if not (self.option.device == "gpu" and self.option.run_mode.startswith("trt")): - if hasattr(config, "enable_new_ir"): - config.enable_new_ir(self.option.enable_new_ir) - if hasattr(config, "enable_new_executor"): - config.enable_new_executor() - if self.option.device in ("cpu", "gpu"): + if self.option.device in ("cpu", "gpu"): + if not ( + self.option.device == "gpu" and self.option.run_mode.startswith("trt") + ): + if hasattr(config, "enable_new_ir"): + config.enable_new_ir(self.option.enable_new_ir) + if hasattr(config, "enable_new_executor"): + config.enable_new_executor() config.set_optimization_level(3) for del_p in self.option.delete_pass: