Skip to content

Commit

Permalink
solve the onnxruntime inference issue (#13154)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghorc committed Jun 21, 2024
1 parent f8ca01d commit 6d5f998
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tools/infer/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,18 @@ 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",
{"device_id": args.gpu_id, "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 6d5f998

Please sign in to comment.