onnxruntime support gpu (#10668)

* Update ch_PP-OCRv3_rec.yml

* Update ch_PP-OCRv3_rec_distillation.yml

* Update en_PP-OCRv3_rec.yml

* Update arabic_PP-OCRv3_rec.yml

* Update chinese_cht_PP-OCRv3_rec.yml

* Update cyrillic_PP-OCRv3_rec.yml

* Update devanagari_PP-OCRv3_rec.yml

* Update japan_PP-OCRv3_rec.yml

* Update ka_PP-OCRv3_rec.yml

* Update korean_PP-OCRv3_rec.yml

* Update latin_PP-OCRv3_rec.yml

* Update ta_PP-OCRv3_rec.yml

* Update te_PP-OCRv3_rec.yml

* Update utility.py
This commit is contained in:
zhoujun 2023-08-17 18:26:20 +08:00 committed by GitHub
parent 8f010ecf1e
commit dbf35bb714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -187,7 +187,10 @@ def create_predictor(args, mode, logger):
if not os.path.exists(model_file_path):
raise ValueError("not find model file path {}".format(
model_file_path))
sess = ort.InferenceSession(model_file_path)
if args.use_gpu:
sess = ort.InferenceSession(model_file_path, providers=['CUDAExecutionProvider'])
else:
sess = ort.InferenceSession(model_file_path)
return sess, sess.get_inputs()[0], None, None
else: