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
9bb2d581
Unverified
Commit
9bb2d581
authored
Feb 07, 2025
by
Xiaomeng Zhao
Committed by
GitHub
Feb 07, 2025
Browse files
Merge pull request #1661 from myhloli/dev
perf(model): optimize batch ratio for different GPU memory sizes
parents
bd35e9d0
b1ac7afd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
magic_pdf/model/doc_analyze_by_custom_model.py
magic_pdf/model/doc_analyze_by_custom_model.py
+11
-12
No files found.
magic_pdf/model/doc_analyze_by_custom_model.py
View file @
9bb2d581
...
...
@@ -178,21 +178,20 @@ def doc_analyze(
gpu_memory
=
int
(
os
.
getenv
(
"VIRTUAL_VRAM_SIZE"
,
round
(
get_vram
(
device
))))
if
gpu_memory
is
not
None
and
gpu_memory
>=
8
:
if
8
<=
gpu_memory
<
10
:
batch_ratio
=
2
elif
10
<=
gpu_memory
<=
12
:
batch_ratio
=
4
elif
12
<
gpu_memory
<=
20
:
batch_ratio
=
8
elif
20
<
gpu_memory
<=
32
:
if
gpu_memory
>=
40
:
batch_ratio
=
32
elif
gpu_memory
>=
20
:
batch_ratio
=
16
elif
gpu_memory
>=
16
:
batch_ratio
=
8
elif
gpu_memory
>=
10
:
batch_ratio
=
4
else
:
batch_ratio
=
3
2
batch_ratio
=
2
if
batch_ratio
>=
1
:
logger
.
info
(
f
'gpu_memory:
{
gpu_memory
}
GB, batch_ratio:
{
batch_ratio
}
'
)
batch_model
=
BatchAnalyze
(
model
=
custom_model
,
batch_ratio
=
batch_ratio
)
batch_analyze
=
True
logger
.
info
(
f
'gpu_memory:
{
gpu_memory
}
GB, batch_ratio:
{
batch_ratio
}
'
)
batch_model
=
BatchAnalyze
(
model
=
custom_model
,
batch_ratio
=
batch_ratio
)
batch_analyze
=
True
model_json
=
[]
doc_analyze_start
=
time
.
time
()
...
...
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