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
fix: add conditional import for torch and torch_npu in config_reader.py
myhlolibd5252d946c7
diff --git a/mineru/utils/config_reader.py b/mineru/utils/config_reader.pyindex f608044e..f6d013ea 100644--- a/mineru/utils/config_reader.py+++ b/mineru/utils/config_reader.py@@ -1,9 +1,15 @@# Copyright (c) Opendatalab. All rights reserved.import jsonimport os-from loguru import logger+try:+ import torch+ import torch_npu+except ImportError:+ pass++# 定义配置文件名常量CONFIG_FILE_NAME = os.getenv('MINERU_TOOLS_CONFIG_JSON', 'mineru.json')@@ -71,15 +77,12 @@ def get_device():if device_mode is not None:return device_modeelse:- import torch-if torch.cuda.is_available():return "cuda"elif torch.backends.mps.is_available():return "mps"else:try:- import torch_npuif torch_npu.npu.is_available():return "npu"except Exception as e: