Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Solve the TRT inference problem when dynamic shape is not set #1640

Merged
merged 1 commit into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions contrib/Matting/deploy/python/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ def parse_args():
)
parser.add_argument(
'--print_detail',
dest='print_detail',
help='Print GLOG information of Paddle Inference.',
action='store_true')
default=True,
type=eval,
choices=[True, False],
help='Print GLOG information of Paddle Inference.')

return parser.parse_args()

Expand Down Expand Up @@ -292,13 +293,11 @@ def _init_gpu_config(self):
precision_mode = precision_map[self.args.precision]

if self.args.use_trt:

print('++++++++++++++')
logger.info("Use TRT")
self.pred_cfg.enable_tensorrt_engine(
workspace_size=1 << 30,
max_batch_size=1,
min_subgraph_size=50,
min_subgraph_size=300,
precision_mode=precision_mode,
use_static=False,
use_calib_mode=False)
Expand All @@ -310,7 +309,6 @@ def _init_gpu_config(self):
self.pred_cfg.enable_tuned_tensorrt_dynamic_shape(
self.args.auto_tuned_shape_file, allow_build_at_runtime)
else:
print('===============')
logger.info("Use manual set dynamic shape")
min_input_shape = {"x": [1, 3, 100, 100]}
max_input_shape = {"x": [1, 3, 2000, 3000]}
Expand Down
9 changes: 5 additions & 4 deletions deploy/python/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ def parse_args():
action='store_true')
parser.add_argument(
'--print_detail',
dest='print_detail',
help='Print GLOG information of Paddle Inference.',
action='store_true')
default=True,
type=eval,
choices=[True, False],
help='Print GLOG information of Paddle Inference.')

return parser.parse_args()

Expand Down Expand Up @@ -295,7 +296,7 @@ def _init_gpu_config(self):
self.pred_cfg.enable_tensorrt_engine(
workspace_size=1 << 30,
max_batch_size=1,
min_subgraph_size=50,
min_subgraph_size=300,
precision_mode=precision_mode,
use_static=False,
use_calib_mode=False)
Expand Down