Skip to content

Commit

Permalink
modify npu models infer bug (#2474)
Browse files Browse the repository at this point in the history
  • Loading branch information
a31413510 authored Nov 14, 2024
1 parent ba4fbcf commit e4e9a12
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions paddlex/inference/components/paddle_predictor/predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit e4e9a12

Please sign in to comment.