Skip to content

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

feat: increase layout base batch size and add VRAM cleanup function

myhloli1d76575efff2
diff --git a/mineru/backend/pipeline/batch_analyze.py b/mineru/backend/pipeline/batch_analyze.py
index ebfffaa3..bc7f9ad6 100644
--- a/mineru/backend/pipeline/batch_analyze.py
+++ b/mineru/backend/pipeline/batch_analyze.py
@@ -25,7 +25,7 @@ from ...utils.ocr_utils import (
)
from ...utils.pdf_image_tools import get_crop_np_img
-LAYOUT_BASE_BATCH_SIZE = 1
+LAYOUT_BASE_BATCH_SIZE = 4
MFR_BASE_BATCH_SIZE = 16
OCR_DET_BASE_BATCH_SIZE = 8
TABLE_ORI_CLS_BATCH_SIZE = 16
@@ -321,6 +321,8 @@ class BatchAnalyze:
images_layout_res += self.model.layout_model.batch_predict(
pil_images, LAYOUT_BASE_BATCH_SIZE
)
+ # 清理显存
+ clean_vram(self.model.device, vram_threshold=8)
if self.formula_enable:
images_mfd_res = []