Skip to content

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

feat: remove unnecessary torch version check and simplify device condition for OCR detection

myhlolic1c38c8318f7
diff --git a/mineru/backend/pipeline/pipeline_analyze.py b/mineru/backend/pipeline/pipeline_analyze.py
index 4a6fdaef..9ec342d7 100644
--- a/mineru/backend/pipeline/pipeline_analyze.py
+++ b/mineru/backend/pipeline/pipeline_analyze.py
@@ -194,13 +194,11 @@ def batch_image_analyze(
import torch
from packaging import version
device_type = os.getenv("MINERU_LMDEPLOY_DEVICE", "")
- if (
- version.parse(torch.__version__) >= version.parse("2.8.0")
- or str(device).startswith('mps')
- or device_type.lower() in ["corex"]
- ):
+ if device_type.lower() in ["corex"]:
enable_ocr_det_batch = False
else:
+ if version.parse(torch.__version__) >= version.parse("2.8.0"):
+ os.environ["TORCH_CUDNN_V8_API_DISABLED"] = "1"
enable_ocr_det_batch = True
batch_model = BatchAnalyze(model_manager, batch_ratio, formula_enable, table_enable, enable_ocr_det_batch)
diff --git a/mineru/model/ori_cls/paddle_ori_cls.py b/mineru/model/ori_cls/paddle_ori_cls.py
index 0ef44f3c..001a9c2e 100644
--- a/mineru/model/ori_cls/paddle_ori_cls.py
+++ b/mineru/model/ori_cls/paddle_ori_cls.py
@@ -174,12 +174,6 @@ class PaddleOrientationClsModel:
def batch_predict(
self, imgs: List[Dict], det_batch_size: int, batch_size: int = 16
) -> None:
-
- import torch
- from packaging import version
- if version.parse(torch.__version__) >= version.parse("2.8.0"):
- return None
-
"""
批量预测传入的包含图片信息列表的旋转信息,并且将旋转过的图片正确地旋转回来
"""