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
89107628
"vscode:/vscode.git/clone" did not exist on "078e398e1c5a8c0296f64a0be435dcc0ce54afcc"
Commit
89107628
authored
Jul 01, 2025
by
myhloli
Browse files
fix: update memory fraction handling in SgLang engine initialization
parent
06db3d17
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
mineru/cli/gradio_app.py
mineru/cli/gradio_app.py
+11
-3
No files found.
mineru/cli/gradio_app.py
View file @
89107628
...
@@ -209,7 +209,7 @@ def update_interface(backend_choice):
...
@@ -209,7 +209,7 @@ def update_interface(backend_choice):
'mem_fraction_static'
,
'mem_fraction_static'
,
type
=
float
,
type
=
float
,
help
=
"Set the static memory fraction for SgLang engine. "
,
help
=
"Set the static memory fraction for SgLang engine. "
,
default
=
0.5
,
default
=
None
,
# 改为默认值为None
)
)
@
click
.
option
(
@
click
.
option
(
'--enable-torch-compile'
,
'--enable-torch-compile'
,
...
@@ -231,12 +231,20 @@ def main(example_enable, sglang_engine_enable, mem_fraction_static, torch_compil
...
@@ -231,12 +231,20 @@ def main(example_enable, sglang_engine_enable, mem_fraction_static, torch_compil
print
(
"Start init SgLang engine..."
)
print
(
"Start init SgLang engine..."
)
from
mineru.backend.vlm.vlm_analyze
import
ModelSingleton
from
mineru.backend.vlm.vlm_analyze
import
ModelSingleton
modelsingleton
=
ModelSingleton
()
modelsingleton
=
ModelSingleton
()
# 构建参数字典
model_params
=
{
"enable_torch_compile"
:
torch_compile_enable
}
# 只有当mem_fraction_static不为None时才添加该参数
if
mem_fraction_static
is
not
None
:
model_params
[
"mem_fraction_static"
]
=
mem_fraction_static
predictor
=
modelsingleton
.
get_model
(
predictor
=
modelsingleton
.
get_model
(
"sglang-engine"
,
"sglang-engine"
,
None
,
None
,
None
,
None
,
mem_fraction_static
=
mem_fraction_static
,
**
model_params
# 使用解包运算符传递参数
enable_torch_compile
=
torch_compile_enable
,
)
)
print
(
"SgLang engine init successfully."
)
print
(
"SgLang engine init successfully."
)
except
Exception
as
e
:
except
Exception
as
e
:
...
...
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