|
|
@@ -1,7 +1,7 @@
|
|
|
import os
|
|
|
import sys
|
|
|
|
|
|
-from mineru.backend.vlm.custom_logits_processors import enable_custom_logits_processors
|
|
|
+from mineru.backend.vlm.utils import set_defult_gpu_memory_utilization, enable_custom_logits_processors
|
|
|
from mineru.utils.models_download_utils import auto_download_and_get_model_root_path
|
|
|
|
|
|
from vllm.entrypoints.cli.main import main as vllm_main
|
|
|
@@ -43,7 +43,8 @@ def main():
|
|
|
if not has_port_arg:
|
|
|
args.extend(["--port", "30000"])
|
|
|
if not has_gpu_memory_utilization_arg:
|
|
|
- args.extend(["--gpu-memory-utilization", "0.7"])
|
|
|
+ gpu_memory_utilization = str(set_defult_gpu_memory_utilization())
|
|
|
+ args.extend(["--gpu-memory-utilization", gpu_memory_utilization])
|
|
|
if not model_path:
|
|
|
model_path = auto_download_and_get_model_root_path("/", "vlm")
|
|
|
if (not has_logits_processors_arg) and custom_logits_processors:
|
|
|
@@ -52,7 +53,8 @@ def main():
|
|
|
# 重构参数,将模型路径作为位置参数
|
|
|
sys.argv = [sys.argv[0]] + ["serve", model_path] + args
|
|
|
|
|
|
- os.environ["OMP_NUM_THREADS"] = "1"
|
|
|
+ if os.getenv('OMP_NUM_THREADS') is None:
|
|
|
+ os.environ["OMP_NUM_THREADS"] = "1"
|
|
|
|
|
|
# 启动vllm服务器
|
|
|
print(f"start vllm server: {sys.argv}")
|