Skip to content

Commit

Permalink
添加{"cudnn_conv_algo_search": "DEFAULT"}参数,加速gpu下onnxruntime推理速度;指定"CP…
Browse files Browse the repository at this point in the history
…UExecutionProvider"参数解决cpu环境下onnxruntime报错
  • Loading branch information
rancai committed Jun 20, 2024
1 parent f8ca01d commit 0f63d56
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/infer/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ def create_predictor(args, mode, logger):
raise ValueError("not find model file path {}".format(model_file_path))
if args.use_gpu:
sess = ort.InferenceSession(
model_file_path, providers=["CUDAExecutionProvider"]
model_file_path, providers=[("CUDAExecutionProvider", {"cudnn_conv_algo_search": "DEFAULT"})]
)
else:
sess = ort.InferenceSession(model_file_path)
sess = ort.InferenceSession(model_file_path, providers=["CPUExecutionProvider"])
return sess, sess.get_inputs()[0], None, None

else:
Expand Down

0 comments on commit 0f63d56

Please sign in to comment.