Skip to content

Commit e4e9a12

Browse files
authored
modify npu models infer bug (#2474)
1 parent ba4fbcf commit e4e9a12

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

paddlex/inference/components/paddle_predictor/predictor.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,14 @@ def _create(self):
176176

177177
config.set_cpu_math_library_num_threads(self.option.cpu_threads)
178178

179-
if not (self.option.device == "gpu" and self.option.run_mode.startswith("trt")):
180-
if hasattr(config, "enable_new_ir"):
181-
config.enable_new_ir(self.option.enable_new_ir)
182-
if hasattr(config, "enable_new_executor"):
183-
config.enable_new_executor()
184-
if self.option.device in ("cpu", "gpu"):
179+
if self.option.device in ("cpu", "gpu"):
180+
if not (
181+
self.option.device == "gpu" and self.option.run_mode.startswith("trt")
182+
):
183+
if hasattr(config, "enable_new_ir"):
184+
config.enable_new_ir(self.option.enable_new_ir)
185+
if hasattr(config, "enable_new_executor"):
186+
config.enable_new_executor()
185187
config.set_optimization_level(3)
186188

187189
for del_p in self.option.delete_pass:

0 commit comments

Comments
 (0)