docling-project / docling-project/docling
Formula Enrichment makes conversion fail when using CLI
- Dominant language
- Python
- Stars
- 66.4k
- Forks
- 4.8k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 84
Description
### Bug
When using the --enrich-formula option in the docling CLI, all documents fail to parse. It seems that the full standard document processing is completed, and then it fails afterwards, perhaps when initializing the formula enrichment.
### Steps to reproduce
I have tried this with ~50 pdfs, so you should be able to use any PDF to reproduce this.
1. Working command: `docling -vvv --no-ocr --image-export-mode referenced --output md_no_enrich pdf_files\*`
Produces the following output:
```
INFO:docling.document_converter:Going to convert document batch...
INFO:docling.document_converter:Initializing pipeline for StandardPdfPipeline with options hash 08328d0cbcb1863c77a6f6d13e470e25
INFO:docling.utils.accelerator_utils:Accelerator device: 'cuda:0'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): huggingface.co:443
DEBUG:urllib3.connectionpool:https://huggingface.co:443 "GET /api/models/ds4sd/docling-models/revision/v2.2.0 HTTP/1.1" 200 1267
DEBUG:docling_ibm_models.layoutmodel.layout_predictor:LayoutPredictor settings: {'safe_tensors_file': 'C:\\Users\\civil\\.cache\\huggingface\\hub\\models--ds4sd--docling-models\\snapshots\\4659a7d29247f9f7a94102e1f313dad8e8c8f2f6\\model_artifacts\\layout\\model.safetensors', 'device': 'cuda', 'num_threads': 4, 'image_size': 640, 'threshold': 0.3}
DEBUG:urllib3.connectionpool:https://huggingface.co:443 "GET /api/models/ds4sd/docling-models/revision/v2.2.0 HTTP/1.1" 200 1267
INFO:docling.utils.accelerator_utils:Accelerator device: 'cuda:0'
INFO:docling.models.factories.base_factory:Loading plugin 'docling_defaults'
INFO:docling.models.factories:Registered picture descriptions: ['vlm', 'api']
INFO:docling.pipeline.base_pipeline:Processing document Azoug (2014) - Influence of fillers and bondi.pdf
DEBUG:docling.pipeline.base_pipeline:Finished converting page batch time=426705.250
DEBUG:docling.pipeline.base_pipeline:Finished converting page batch time=426724.875
DEBUG:docling.pipeline.base_pipeline:Finished converting page batch time=426725.328
INFO:docling.document_converter:Finished converting document Azoug (2014) - Influence of fillers and bondi.pdf in 108.80 sec.
INFO:docling.cli.main:writing Markdown output to md_no_enrich\Azoug (2014) - Influence of fillers and bondi.md
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 20161
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 5071
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 5149
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 5149
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 26669
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 5149
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 54935
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 5149
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 44790
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 61231
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 5149
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 65536
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 44355
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 43540
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 65536
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 5149
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 65536
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 5149
DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13
DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 5141
INFO:docling.cli.main:Processed 1 docs, of which 0 failed
INFO:docling.cli.main:All documents were converted in 109.80 seconds.
```
The correct .md file and artifacts folders are created
2. Non-functioning command: `docling -vvv --no-ocr --image-export-mode referenced --enrich-formula --output md_enrich_all pdf_files\*`
Produces the following output:
```
INFO:docling.document_converter:Going to convert document batch...
INFO:docling.document_converter:Initializing pipeline for StandardPdfPipeline with options hash 1591f1f2a34b25441f456b744096c7a8
INFO:docling.utils.accelerator_utils:Accelerator device: 'cuda:0'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): huggingface.co:443
DEBUG:urllib3.connectionpool:https://huggingface.co:443 "GET /api/models/ds4sd/docling-models/revision/v2.2.0 HTTP/1.1" 200 1267
DEBUG:docling_ibm_models.layoutmodel.layout_predictor:LayoutPredictor settings: {'safe_tensors_file': 'C:\\Users\\civil\\.cache\\huggingface\\hub\\models--ds4sd--docling-models\\snapshots\\4659a7d29247f9f7a94102e1f313dad8e8c8f2f6\\model_artifacts\\layout\\model.safetensors', 'device': 'cuda', 'num_threads': 4, 'image_size': 640, 'threshold': 0.3}
DEBUG:urllib3.connectionpool:https://huggingface.co:443 "GET /api/models/ds4sd/docling-models/revision/v2.2.0 HTTP/1.1" 200 1267
INFO:docling.utils.accelerator_utils:Accelerator device: 'cuda:0'
INFO:docling.models.factories.base_factory:Loading plugin 'docling_defaults'
INFO:docling.models.factories:Registered picture descriptions: ['vlm', 'api']
INFO:docling.utils.accelerator_utils:Accelerator device: 'cuda:0'
DEBUG:urllib3.connectionpool:https://huggingface.co:443 "GET /api/models/ds4sd/CodeFormula/revision/v1.0.2 HTTP/1.1" 200 1195
DEBUG:docling_ibm_models.code_formula_model.code_formula_predictor:CodeFormulaModel settings: {'device': 'cuda:0', 'num_threads': 4}
INFO:docling.pipeline.base_pipeline:Processing document Azoug (2014) - Influence of fillers and bondi.pdf
DEBUG:docling.pipeline.base_pipeline:Finished converting page batch time=427611.984
DEBUG:docling.pipeline.base_pipeline:Finished converting page batch time=427616.515
DEBUG:docling.pipeline.base_pipeline:Finished converting page batch time=427616.906
INFO:docling.document_converter:Finished converting document Azoug (2014) - Influence of fillers and bondi.pdf in 109.80 sec.
WARNING:docling.cli.main:Document C:\Users\civil\AppData\Local\Temp\tmpmcfnx1ly\Azoug (2014) - Influence of fillers and bondi.pdf failed to convert.
INFO:docling.cli.main:Processed 1 docs, of which 1 failed
INFO:docling.cli.main:All documents were converted in 109.85 seconds.
```
Which only creates the output folder, but no .md files
### Docling version
```
Docling version: 2.37.0
Docling Core version: 2.37.0
Docling IBM Models version: 3.4.4
Docling Parse version: 4.0.5
Python: cpython-311 (3.11.1)
Platform: Windows-10-10.0.19045-SP0
```
### Python version
```
Python 3.11.1
```
Contributor guide
Assessment
This issue has not been assessed yet.