Browse Source

fix: disable tokenizers parallelism in lmdeploy server configuration

myhloli 2 weeks ago
parent
commit
6bafca0555
1 changed files with 3 additions and 2 deletions
  1. 3 2
      mineru/model/vlm/lmdeploy_server.py

+ 3 - 2
mineru/model/vlm/lmdeploy_server.py

@@ -52,6 +52,9 @@ def main():
         lm_backend = set_lmdeploy_backend(device_type)
     logger.info(f"Set lmdeploy_backend to: {lm_backend}")
 
+    if lm_backend == "pytorch":
+        os.environ["TOKENIZERS_PARALLELISM"] = "false"
+
     # args中如果有--backend参数,则不设置
     if not has_backend_arg:
         args.extend(["--backend", lm_backend])
@@ -64,8 +67,6 @@ def main():
     if os.getenv('OMP_NUM_THREADS') is None:
         os.environ["OMP_NUM_THREADS"] = "1"
 
-    os.environ["TOKENIZERS_PARALLELISM"] = "false"
-
     # 启动 lmdeploy 服务器
     print(f"start lmdeploy server: {sys.argv}")