Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web_demo与当前版本不适配,出现TypeError: object of type 'ABCMeta' has no len() #1400

Closed
luckywhc opened this issue Jan 3, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@luckywhc
Copy link

luckywhc commented Jan 3, 2025

Description of the bug | 错误描述

magic-pdf, version 0.10.6下使用web_demo工程后台的api,出现解析pdf失败
同一文件使用magic-pdf命令行正常
2025-01-03 15:44:10.103 | INFO | magic_pdf.model.pdf_extract_kit:init:170 - DocAnalysis init done!
2025-01-03 15:44:10.103 | INFO | magic_pdf.model.doc_analyze_by_custom_model:custom_model_init:181 - model init cost: 8.995175838470459
<class 'magic_pdf.data.dataset.Dataset'>
2025-01-03 15:44:10.103 | ERROR | api.analysis.pdf_ext:analysis_pdf:53 - Traceback (most recent call last):
File "/opt/MinerU/projects/web_demo/web_demo/api/analysis/pdf_ext.py", line 41, in analysis_pdf
pipe.pipe_analyze()
File "/opt/mineru_venv/lib/python3.10/site-packages/magic_pdf/pipe/UNIPipe.py", line 63, in pipe_analyze
self.model_list = doc_analyze(
File "/opt/mineru_venv/lib/python3.10/site-packages/magic_pdf/model/doc_analyze_by_custom_model.py", line 214, in doc_analyze
end_page_id = len(dataset)
TypeError: object of type 'ABCMeta' has no len()

2025-01-03 15:44:10.104 | ERROR | api.analysis.pdf_ext:analysis_pdf_task:137 - Traceback (most recent call last):
File "/opt/MinerU/projects/web_demo/web_demo/api/analysis/pdf_ext.py", line 97, 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

2025-01-03 15:44:10.133 | INFO | api.analysis.pdf_ext:analysis_pdf_task:170 - all task finished!
Exception in thread Thread-3 (analysis_pdf_task):
Traceback (most recent call last):
File "/opt/MinerU/projects/web_demo/web_demo/api/analysis/pdf_ext.py", line 97, 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 "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/opt/MinerU/projects/web_demo/web_demo/api/analysis/pdf_ext.py", line 147, 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 | 如何复现

web_demo使用/api/v2/extract/task/submit可复现

Operating system | 操作系统

Linux

Python version | Python 版本

3.10

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

0.10.x

Device mode | 设备模式

cuda

@luckywhc luckywhc added the bug Something isn't working label Jan 3, 2025
@myhloli
Copy link
Collaborator

myhloli commented Jan 5, 2025

0.10.6是0.x到1.0之间的一个过渡版本,存在较大的api修改,如果需要使用webdemo,请将magic-pdf降级回0.10.5

@myhloli myhloli closed this as completed Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants