docling-project / docling-project/docling

Runtime Error

Open
#2,184 3 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
3d 4h
Merged PRs (30d)
98

Description

### Question
Hello,
Name: docling
Version: 2.50.0

I run into a runtime error when i try to parse certain documents.

This is basically the code i am running:
```
pipeline_options = PdfPipelineOptions()
pipeline_options.do_ocr = False
pipeline_options.do_table_structure = False
pipeline_options.table_structure_options.do_cell_matching = False

doc_converter = DocumentConverter(
format_options={InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)}
)

result = doc_converter.convert(str(source_path))

start = time.time()
result = doc_converter.convert(source_path)
result_markdown = result.document.export_to_markdown()
end = time.time()
```
and i run into this error:
```
Encountered an error during conversion of document 699a106777c2f26e654066f78dc672e1b0c3a42cd0a7036fb8d849fbbf3ee324:
Traceback (most recent call last):

File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\pipeline\base_pipeline.py", line 164, in _build_document
for p in pipeline_pages: # Must exhaust!

File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\pipeline\base_pipeline.py", line 129, in _apply_on_pages
yield from page_batch

File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\models\page_assemble_model.py", line 70, in __call__
for page in page_batch:

File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\models\table_structure_model.py", line 174, in __call__
yield from page_batch

File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\models\layout_model.py", line 152, in __call__
pages = list(page_batch)
^^^^^^^^^^^^^^^^

File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\models\easyocr_model.py", line 130, in __call__
yield from page_batch

File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\models\page_preprocessing_model.py", line 48, in __call__
page = self._parse_page_cells(conv_res, page)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\models\page_preprocessing_model.py", line 72, in _parse_page_cells
page.parsed_page = page._backend.get_segmented_page()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\backend\docling_parse_v4_backend.py", line 96, in get_segmented_page
self._ensure_parsed()

File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\backend\docling_parse_v4_backend.py", line 48, in _ensure_parsed
seg_page = self._dp_doc.get_page(
^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling_parse\pdf_parser.py", line 136, in get_page
doc_dict = self._parser.parse_pdf_from_key_on_page(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

RuntimeError: parameters.size() < 1

Traceback (most recent call last):
File "C:\Users\Simon\programming\brfAI\temp.py", line 26, in
result = doc_converter.convert(str(source_path))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\pydantic\_internal\_validate_call.py", line 39, in wrapper_function
return wrapper(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\pydantic\_internal\_validate_call.py", line 136, in __call__
res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\document_converter.py", line 241, in convert
return next(all_res)
^^^^^^^^^^^^^
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\document_converter.py", line 264, in convert_all
for conv_res in conv_res_iter:
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\document_converter.py", line 336, in _convert
for item in map(
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\document_converter.py", line 383, in _process_document
conv_res = self._execute_pipeline(in_doc, raises_on_error=raises_on_error)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\document_converter.py", line 406, in _execute_pipeline
conv_res = pipeline.execute(in_doc, raises_on_error=raises_on_error)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\pipeline\base_pipeline.py", line 57, in execute
raise e
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\pipeline\base_pipeline.py", line 49, in execute
conv_res = self._build_document(conv_res)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\pipeline\base_pipeline.py", line 204, in _build_document
raise e
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\pipeline\base_pipeline.py", line 164, in _build_document
for p in pipeline_pages: # Must exhaust!
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\pipeline\base_pipeline.py", line 129, in _apply_on_pages
yield from page_batch
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\models\page_assemble_model.py", line 70, in __call__
for page in page_batch:
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\models\table_structure_model.py", line 174, in __call__
yield from page_batch
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\models\layout_model.py", line 152, in __call__
pages = list(page_batch)
^^^^^^^^^^^^^^^^
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\models\easyocr_model.py", line 130, in __call__
yield from page_batch
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\models\page_preprocessing_model.py", line 48, in __call__
page = self._parse_page_cells(conv_res, page)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\models\page_preprocessing_model.py", line 72, in _parse_page_cells
page.parsed_page = page._backend.get_segmented_page()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\backend\docling_parse_v4_backend.py", line 96, in get_segmented_page
self._ensure_parsed()
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling\backend\docling_parse_v4_backend.py", line 48, in _ensure_parsed
seg_page = self._dp_doc.get_page(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Simon\anaconda3\envs\brfai\Lib\site-packages\docling_parse\pdf_parser.py", line 136, in get_page
doc_dict = self._parser.parse_pdf_from_key_on_page(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: parameters.size() < 1
```

I can parse this PDF using PyPDF2 so the PDF should be parseable (I just cant get good enough results using PYPDF2)
Have anyone ran into this issue and know how to solve it?

I have tried different combinations of there options but that does not seem to be it:
```
pipeline_options = PdfPipelineOptions()
pipeline_options.do_ocr = False
pipeline_options.do_table_structure = False
pipeline_options.table_structure_options.do_cell_matching = False
```

[EDIT]
I should also mention that the exact same code works for another PDF.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure through DocumentConverter.convert with the affected PDF and compare it with the PDF that succeeds. Trace the reported path through docling/pipeline/page_preprocessing_model.py, docling/backend/docling_parse_v4_backend.py, and docling_parse/pdf_parser.py, focusing on the parameters.size() < 1 error. Done means the affected document converts successfully without regressing the working PDF.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.