Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
refactor: enhance device mode detection to support CUDA and MPS
myhloli7c8fb44b1398
diff --git a/mineru/backend/pipeline/config_reader.py b/mineru/backend/pipeline/config_reader.pyindex 01b24ad0..7aa5d407 100644--- a/mineru/backend/pipeline/config_reader.py+++ b/mineru/backend/pipeline/config_reader.py@@ -2,6 +2,7 @@import jsonimport os+import torchfrom loguru import logger# 定义配置文件名常量@@ -93,8 +94,11 @@ def get_device():if device_mode is not None:return device_modeelse:- logger.warning(f"not found 'MINERU_DEVICE_MODE' in environment variable, use 'cpu' as default.")- return 'cpu'+ if torch.cuda.is_available():+ return "cuda"+ if torch.backends.mps.is_available():+ return "mps"+ return "cpu"def get_table_recog_config():