opendatalab / MinerU

A high-quality tool for convert PDF to Markdown and JSON.一站式开源高质量数据提取工具,将PDF转换成Markdown和JSON格式。
https://opendatalab.com/OpenSourceTools?tool=extract
GNU Affero General Public License v3.0
17.63k stars 1.28k forks source link

提取错误 #1029

Open YANGtzeRi opened 2 hours ago

YANGtzeRi commented 2 hours ago

Description of the bug | 错误描述

完成本地部署后提取文档出现错误 2024-11-19 19:01:46.298 | INFO | magic_pdf.pdf_parse_union_core_v2:pdf_parse_union:647 - page_id: 0, last_page_cost_time: 0.0 2024-11-19 19:01:48.628 | INFO | magic_pdf.pdf_parse_union_core_v2:pdf_parse_union:647 - page_id: 1, last_page_cost_time: 2.33 2024-11-19 19:01:48.748 | ERROR | api.analysis.pdf_ext:analysis_pdf:50 - Traceback (most recent call last): File "D:\Yangtze\GitHub\MinerU\projects\web_demo\web_demo\api\analysis\pdf_ext.py", line 42, in analysis_pdf pipe.pipe_parse() File "C:\Users\yangt.conda\envs\MinerU\lib\site-packages\magic_pdf\pipe\UNIPipe.py", line 50, in pipe_parse self.pdf_mid_data = parse_ocr_pdf(self.pdf_bytes, self.model_list, self.image_writer, File "C:\Users\yangt.conda\envs\MinerU\lib\site-packages\magic_pdf\user_api.py", line 59, in parse_ocr_pdf pdf_info_dict = parse_pdf_by_ocr( File "C:\Users\yangt.conda\envs\MinerU\lib\site-packages\magic_pdf\pdf_parse_by_ocr.py", line 14, in parse_pdf_by_ocr return pdf_parse_union(dataset, File "C:\Users\yangt.conda\envs\MinerU\lib\site-packages\magic_pdf\pdf_parse_union_core_v2.py", line 654, in pdf_parse_union page_info = parse_page_core( File "C:\Users\yangt.conda\envs\MinerU\lib\site-packages\magic_pdf\pdf_parse_union_core_v2.py", line 541, in parse_page_core spans = ocr_cut_image_and_table( File "C:\Users\yangt.conda\envs\MinerU\lib\site-packages\magic_pdf\pre_proc\cut_image.py", line 17, in ocr_cut_image_and_table span['image_path'] = cut_image(span['bbox'], page_id, page, return_path=return_path('images'), File "C:\Users\yangt.conda\envs\MinerU\lib\site-packages\magic_pdf\libs\pdf_image_tools.py", line 31, in cut_image imageWriter.write(byte_data, img_hash256_path, AbsReaderWriter.MODE_BIN) File "C:\Users\yangt.conda\envs\MinerU\lib\site-packages\magic_pdf\rw\DiskReaderWriter.py", line 41, in write with open(abspath, "wb") as f: FileNotFoundError: [Errno 2] No such file or directory: 'D:\Yangtze\GitHub\MinerU\projects\web_demo\web_demo\static/analysis_pdf/3b547652aeedd05cbcb1249efe2ebcb3405844486675188b4c1ad17f9517536d1732014031_Multipath_chirp_signal_detection_based_on_biorthogonal_fourier_transform/images\43feeaa3f1f8c0a362ccbff693581ce943d1e106eb396cdcea4eeabef0e37f71.jpg'

2024-11-19 19:01:48.751 | ERROR | api.analysis.pdf_ext:analysis_pdf_task:134 - Traceback (most recent call last): File "D:\Yangtze\GitHub\MinerU\projects\web_demo\web_demo\api\analysis\pdf_ext.py", line 94, in analysis_pdf_task md_content, bbox_info = analysis_pdf(image_url_prefix, image_dir, pdf_bytes, is_ocr) TypeError: cannot unpack non-iterable NoneType object

2024-11-19 19:01:48.779 | INFO | api.analysis.pdf_ext:analysis_pdf_task:167 - all task finished! Exception in thread Thread-10 (analysis_pdf_task): Traceback (most recent call last): File "D:\Yangtze\GitHub\MinerU\projects\web_demo\web_demo\api\analysis\pdf_ext.py", line 94, in analysis_pdf_task md_content, bbox_info = analysis_pdf(image_url_prefix, image_dir, pdf_bytes, is_ocr) TypeError: cannot unpack non-iterable NoneType object

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\yangt.conda\envs\MinerU\lib\threading.py", line 1016, in _bootstrap_inner self.run() File "C:\Users\yangt.conda\envs\MinerU\lib\threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "D:\Yangtze\GitHub\MinerU\projects\web_demo\web_demo\api\analysis\pdf_ext.py", line 144, in analysis_pdf_task raise ApiException(code=500, msg="PDF parsing failed", msgZH="pdf解析失败") common.error_types.ApiException: 500 Internal Server Error: PDF parsing failed

How to reproduce the bug | 如何复现

本地环境 Environment info:


sys.platform win32 Python 3.10.15 packaged by Anaconda, Inc. (main, Oct 3 2024, 07:22:19) [MSC v.1929 64 bit (AMD64)] numpy 1.26.3 detectron2 0.6 @C:\Users\yangt.conda\envs\MinerU\lib\site-packages\detectron2 Compiler MSVC 194033811 CUDA compiler not available DETECTRON2_ENV_MODULE PyTorch 2.3.1+cu118 @C:\Users\yangt.conda\envs\MinerU\lib\site-packages\torch PyTorch debug build False torch._C._GLIBCXX_USE_CXX11_ABI False GPU available Yes GPU 0 NVIDIA GeForce RTX 4060 Laptop GPU (arch=8.9) Driver version 551.76 CUDA_HOME C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3 Pillow 10.2.0 torchvision 0.18.1+cu118 @C:\Users\yangt.conda\envs\MinerU\lib\site-packages\torchvision torchvision arch flags C:\Users\yangt.conda\envs\MinerU\lib\site-packages\torchvision_C.pyd; cannot find cuobjdump fvcore 0.1.5.post20221221 iopath 0.1.9 cv2 4.6.0

PyTorch built with:

[11/19 19:00:52 detectron2]: Command line arguments: {'config_file': 'C:\Users\yangt\.conda\envs\MinerU\lib\site-packages\magic_pdf\resources\model_config\layoutlmv3\layoutlmv3_base_inference.yaml', 'resume': False, 'eval_only': False, 'num_gpus': 1, 'num_machines': 1, 'machine_rank': 0, 'dist_url': 'tcp://127.0.0.1:57823', 'opts': ['MODEL.WEIGHTS', 'C:\Users\yangt\.cache\modelscope\hub\opendatalab\PDF-Extract-Kit-1___0/models\Layout/LayoutLMv3/model_final.pth']} [11/19 19:00:52 detectron2]: Contents of args.config_file=C:\Users\yangt.conda\envs\MinerU\lib\site-packages\magic_pdf\resources\model_config\layoutlmv3\layoutlmv3_base_inference.yaml: AUG: DETR: true CACHE_DIR: ~/cache/huggingface CUDNN_BENCHMARK: false DATALOADER: ASPECT_RATIO_GROUPING: true FILTER_EMPTY_ANNOTATIONS: false NUM_WORKERS: 4 REPEAT_THRESHOLD: 0.0 SAMPLER_TRAIN: TrainingSampler DATASETS: PRECOMPUTED_PROPOSAL_TOPK_TEST: 1000 PRECOMPUTED_PROPOSAL_TOPK_TRAIN: 2000 PROPOSAL_FILES_TEST: [] PROPOSAL_FILES_TRAIN: [] TEST:

Operating system | 操作系统

Windows

Python version | Python 版本

3.10

Software version | 软件版本 (magic-pdf --version)

0.9.x

Device mode | 设备模式

cuda

myhloli commented 2 hours ago

命令行功功能可以正常使用吗?