docling-project / docling-project/docling

Some corrupted PDFs wil cause EasyOCR to download models even if local `artifacts_path` is provided

Open
#1,879 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
2d 21h
Merged PRs (30d)
84

Description

### Bug
I'm converting a bunch of PDFs in an isolated environment without Internet access. So I had to pre-fetch the docling models in order for the conversion process to run.

It runs smoothly most of the time, except for a weird behavior on some corrupted PDF files: the EasyOCR message `Downloading detection model, please wait. This may take several minutes depending upon your network connection.` appears but the download fails with `OSError: Tunnel connection failed: 403 Forbidden` and `urllib.error.URLError: ` due to the lack of internet connection. Why is the corrupted file leading to a bypass of the `pipeline_options` settings?

I'm attaching an example of corrupted PDF that leads

[7701.pdf](https://github.com/user-attachments/files/21000655/7701.pdf)

to this behavior.
...

### Steps to reproduce
Here is the exact pipeline I'm using:

```python
from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import PdfPipelineOptions
from docling.datamodel.settings import settings
from docling.document_converter import DocumentConverter, PdfFormatOption

pipeline_options = PdfPipelineOptions(artifacts_path=`~/.cache/docling/models`)
pipeline_options.images_scale = 2.0
pipeline_options.generate_picture_images = True
pipeline_options.do_code_enrichment = True
pipeline_options.do_picture_classification = True
pipeline_options.do_ocr = False

settings.debug.profile_pipeline_timings = True

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

pdf_path = `7701.pdf`
result = doc_converter.convert(pdf_path)
```
...

### Docling version
2.36.1
...

### Python version
3.12.9
...

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.