Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pdf-miner
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Qin Kaijie
pdf-miner
Commits
a3358878
Commit
a3358878
authored
Oct 08, 2024
by
liukaiwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: merge formula update
parent
763688c0
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
905 additions
and
0 deletions
+905
-0
mfr_cudagraph.py
magic_pdf/model/mfr_cudagraph.py
+899
-0
pdf_extract_kit.py
magic_pdf/model/pdf_extract_kit.py
+6
-0
No files found.
magic_pdf/model/mfr_cudagraph.py
0 → 100644
View file @
a3358878
This diff is collapsed.
Click to expand it.
magic_pdf/model/pdf_extract_kit.py
View file @
a3358878
...
@@ -5,6 +5,7 @@ import time
...
@@ -5,6 +5,7 @@ import time
from
magic_pdf.libs.Constants
import
*
from
magic_pdf.libs.Constants
import
*
from
magic_pdf.libs.clean_memory
import
clean_memory
from
magic_pdf.libs.clean_memory
import
clean_memory
from
magic_pdf.model.model_list
import
AtomicModel
from
magic_pdf.model.model_list
import
AtomicModel
from
.mfr_cudagraph
import
GraphRunner
os
.
environ
[
'NO_ALBUMENTATIONS_UPDATE'
]
=
'1'
# 禁止albumentations检查更新
os
.
environ
[
'NO_ALBUMENTATIONS_UPDATE'
]
=
'1'
# 禁止albumentations检查更新
os
.
environ
[
'YOLO_VERBOSE'
]
=
'False'
# disable yolo logger
os
.
environ
[
'YOLO_VERBOSE'
]
=
'False'
# disable yolo logger
...
@@ -67,6 +68,11 @@ def mfr_model_init(weight_dir, cfg_path, _device_='cpu'):
...
@@ -67,6 +68,11 @@ def mfr_model_init(weight_dir, cfg_path, _device_='cpu'):
model
=
task
.
build_model
(
cfg
)
model
=
task
.
build_model
(
cfg
)
model
.
to
(
_device_
)
model
.
to
(
_device_
)
model
.
eval
()
model
.
eval
()
model
=
model
.
to
(
_device_
)
if
'cuda'
in
_device_
:
decoder_runner
=
GraphRunner
(
model
.
model
.
model
.
decoder
.
model
.
decoder
,
max_batchs
=
128
,
max_kvlens
=
256
,
device
=
_device_
)
model
.
model
.
model
.
decoder
.
model
.
decoder
=
decoder_runner
vis_processor
=
load_processor
(
'formula_image_eval'
,
cfg
.
config
.
datasets
.
formula_rec_eval
.
vis_processor
.
eval
)
vis_processor
=
load_processor
(
'formula_image_eval'
,
cfg
.
config
.
datasets
.
formula_rec_eval
.
vis_processor
.
eval
)
mfr_transform
=
transforms
.
Compose
([
vis_processor
,
])
mfr_transform
=
transforms
.
Compose
([
vis_processor
,
])
return
[
model
,
mfr_transform
]
return
[
model
,
mfr_transform
]
...
...
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