Commit 8d97e330 authored by zhougaofeng's avatar zhougaofeng
Browse files

Update ocr_server.py

parent b65d91ea
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
# LICENSE file in the root directory of this source tree # LICENSE file in the root directory of this source tree
import configparser import configparser
import copy import copy
import os
import re import re
import gc import gc
import time import time
...@@ -44,7 +45,7 @@ def _get_args(): ...@@ -44,7 +45,7 @@ def _get_args():
parser.add_argument('--dcu_id', type=str, default='0', help='Specify the GPU ID to load the model onto.') parser.add_argument('--dcu_id', type=str, default='0', help='Specify the GPU ID to load the model onto.')
parser.add_argument( parser.add_argument(
'--config_path', '--config_path',
default='/home/practice/magic_pdf-main/magic_pdf/config.ini', default='./magic_pdf/config.ini',
) )
args = parser.parse_args() args = parser.parse_args()
return args return args
...@@ -56,6 +57,7 @@ def _load_model_processor(args): ...@@ -56,6 +57,7 @@ def _load_model_processor(args):
else: else:
if args.dcu_id is not None: if args.dcu_id is not None:
device_map = {'': f'cuda:{args.dcu_id}'} device_map = {'': f'cuda:{args.dcu_id}'}
os.environ['CUDA_VISIBLE_DEVICES'] = args.dcu_id
print('使用DCU推理:', f'cuda:{args.dcu_id}') print('使用DCU推理:', f'cuda:{args.dcu_id}')
else: else:
device_map = 'auto' device_map = 'auto'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment