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
1c9f9942
Unverified
Commit
1c9f9942
authored
Jan 10, 2025
by
Xiaomeng Zhao
Committed by
GitHub
Jan 10, 2025
Browse files
Merge pull request #1483 from opendatalab/dev
docs: update readme
parents
19164126
4f3ed4ec
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
13 deletions
+65
-13
README.md
README.md
+30
-6
README_zh-CN.md
README_zh-CN.md
+29
-6
magic_pdf/libs/clean_memory.py
magic_pdf/libs/clean_memory.py
+2
-0
magic_pdf/model/pdf_extract_kit.py
magic_pdf/model/pdf_extract_kit.py
+4
-1
No files found.
README.md
View file @
1c9f9942
This diff is collapsed.
Click to expand it.
README_zh-CN.md
View file @
1c9f9942
This diff is collapsed.
Click to expand it.
magic_pdf/libs/clean_memory.py
View file @
1c9f9942
...
...
@@ -12,4 +12,6 @@ def clean_memory(device='cuda'):
import
torch_npu
if
torch_npu
.
npu
.
is_available
():
torch_npu
.
npu
.
empty_cache
()
elif
str
(
device
).
startswith
(
"mps"
):
torch
.
mps
.
empty_cache
()
gc
.
collect
()
\ No newline at end of file
magic_pdf/model/pdf_extract_kit.py
View file @
1c9f9942
...
...
@@ -92,6 +92,8 @@ class CustomPEKModel:
import
torch_npu
os
.
environ
[
'FLAGS_npu_jit_compile'
]
=
'0'
os
.
environ
[
'FLAGS_use_stride_kernel'
]
=
'0'
elif
str
(
self
.
device
).
startswith
(
"mps"
):
os
.
environ
[
'PYTORCH_ENABLE_MPS_FALLBACK'
]
=
'1'
logger
.
info
(
'using device: {}'
.
format
(
self
.
device
))
models_dir
=
kwargs
.
get
(
...
...
@@ -119,11 +121,12 @@ class CustomPEKModel:
os
.
path
.
join
(
models_dir
,
self
.
configs
[
'weights'
][
self
.
mfr_model_name
])
)
mfr_cfg_path
=
str
(
os
.
path
.
join
(
model_config_dir
,
'UniMERNet'
,
'demo.yaml'
))
self
.
mfr_model
=
atom_model_manager
.
get_atom_model
(
atom_model_name
=
AtomicModel
.
MFR
,
mfr_weight_dir
=
mfr_weight_dir
,
mfr_cfg_path
=
mfr_cfg_path
,
device
=
self
.
device
,
device
=
'cpu'
if
str
(
self
.
device
).
startswith
(
"mps"
)
else
self
.
device
,
)
# 初始化layout模型
...
...
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