提交 bb54e9b8 编写于 作者: L LDOUBLEV

fix

上级 9d85d9a7
...@@ -227,19 +227,21 @@ def create_predictor(args, mode, logger): ...@@ -227,19 +227,21 @@ def create_predictor(args, mode, logger):
use_calib_mode=False) use_calib_mode=False)
# collect shape # collect shape
model_name = os.path.basename(model_dir[:-1]) if model_dir.endswith("/") else os.path.basename(model_dir) model_name = os.path.basename(
model_dir[:-1]) if model_dir.endswith(
"/") else os.path.basename(model_dir)
trt_shape_f = f"{mode}_{model_name}.txt" trt_shape_f = f"{mode}_{model_name}.txt"
if trt_shape_f is not None:
if not os.path.exists(trt_shape_f): if not os.path.exists(trt_shape_f):
config.collect_shape_range_info(trt_shape_f) config.collect_shape_range_info(trt_shape_f)
logger.info( logger.info(
f"collect dynamic shape info into : {trt_shape_f}" f"collect dynamic shape info into : {trt_shape_f}")
) try:
else: config.enable_tuned_tensorrt_dynamic_shape(trt_shape_f,
logger.info( True)
f"dynamic shape info file( {trt_shape_f} ) already exists, not need to generate again." except Exception as E:
) logger.info(E)
config.enable_tuned_tensorrt_dynamic_shape(trt_shape_f, True) logger.info("Please keep your paddlepaddle-gpu >= 2.3.0!")
elif args.use_npu: elif args.use_npu:
config.enable_npu() config.enable_npu()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册