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
wangsen
MinerU
Commits
a2808f3a
Commit
a2808f3a
authored
Mar 21, 2025
by
myhloli
Browse files
Merge remote-tracking branch 'origin/dev' into dev
parents
3f2bafa8
dba28389
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
9 deletions
+8
-9
magic_pdf/model/doc_analyze_by_custom_model.py
magic_pdf/model/doc_analyze_by_custom_model.py
+4
-4
magic_pdf/model/sub_modules/mfr/unimernet/Unimernet.py
magic_pdf/model/sub_modules/mfr/unimernet/Unimernet.py
+0
-1
projects/web_api/download_models.py
projects/web_api/download_models.py
+4
-4
No files found.
magic_pdf/model/doc_analyze_by_custom_model.py
View file @
a2808f3a
...
@@ -257,13 +257,13 @@ def may_batch_image_analyze(
...
@@ -257,13 +257,13 @@ def may_batch_image_analyze(
if
str
(
device
).
startswith
(
'npu'
)
or
str
(
device
).
startswith
(
'cuda'
):
if
str
(
device
).
startswith
(
'npu'
)
or
str
(
device
).
startswith
(
'cuda'
):
gpu_memory
=
int
(
os
.
getenv
(
'VIRTUAL_VRAM_SIZE'
,
round
(
get_vram
(
device
))))
gpu_memory
=
int
(
os
.
getenv
(
'VIRTUAL_VRAM_SIZE'
,
round
(
get_vram
(
device
))))
if
gpu_memory
is
not
None
:
if
gpu_memory
is
not
None
:
if
gpu_memory
>=
20
:
if
gpu_memory
>=
16
:
batch_ratio
=
16
batch_ratio
=
16
elif
gpu_memory
>=
1
5
:
elif
gpu_memory
>=
1
2
:
batch_ratio
=
8
batch_ratio
=
8
elif
gpu_memory
>=
10
:
elif
gpu_memory
>=
8
:
batch_ratio
=
4
batch_ratio
=
4
elif
gpu_memory
>=
7
:
elif
gpu_memory
>=
6
:
batch_ratio
=
2
batch_ratio
=
2
else
:
else
:
batch_ratio
=
1
batch_ratio
=
1
...
...
magic_pdf/model/sub_modules/mfr/unimernet/Unimernet.py
View file @
a2808f3a
...
@@ -30,7 +30,6 @@ class UnimernetModel(object):
...
@@ -30,7 +30,6 @@ class UnimernetModel(object):
self
.
model
=
self
.
model
.
to
(
dtype
=
torch
.
float16
)
self
.
model
=
self
.
model
.
to
(
dtype
=
torch
.
float16
)
self
.
model
.
eval
()
self
.
model
.
eval
()
def
predict
(
self
,
mfd_res
,
image
):
def
predict
(
self
,
mfd_res
,
image
):
formula_list
=
[]
formula_list
=
[]
mf_image_list
=
[]
mf_image_list
=
[]
...
...
projects/web_api/download_models.py
View file @
a2808f3a
...
@@ -4,12 +4,12 @@ from huggingface_hub import snapshot_download
...
@@ -4,12 +4,12 @@ from huggingface_hub import snapshot_download
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
mineru_patterns
=
[
mineru_patterns
=
[
"models/Layout/LayoutLMv3/*"
,
#
"models/Layout/LayoutLMv3/*",
"models/Layout/YOLO/*"
,
"models/Layout/YOLO/*"
,
"models/MFD/YOLO/*"
,
"models/MFD/YOLO/*"
,
"models/MFR/unimernet_small_250
1
/*"
,
"models/MFR/unimernet_
hf_
small_250
3
/*"
,
"models/TabRec/TableMaster/*"
,
#
"models/TabRec/TableMaster/*",
"models/TabRec/StructEqTable/*"
,
#
"models/TabRec/StructEqTable/*",
]
]
model_dir
=
snapshot_download
(
model_dir
=
snapshot_download
(
"opendatalab/PDF-Extract-Kit-1.0"
,
"opendatalab/PDF-Extract-Kit-1.0"
,
...
...
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