Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
zhougaofeng
magic_pdf
Commits
8d97e330
Commit
8d97e330
authored
Nov 22, 2024
by
zhougaofeng
Browse files
Update ocr_server.py
parent
b65d91ea
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
magic_pdf/dict2md/ocr_server.py
magic_pdf/dict2md/ocr_server.py
+3
-1
No files found.
magic_pdf/dict2md/ocr_server.py
View file @
8d97e330
...
@@ -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'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment