docling-project / docling-project/docling

VRAM exhaustion triggered by content complexity rather than PDF size

Open
#2,522 4 comments 0 reactions 1 assignee Claimed by @PeterStaar-IBM View on GitHub
bug pdf parsing
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
2d 21h
Merged PRs (30d)
84

Description

### Bug

The Process is hitting OOM (VRAM) on the contents of the PDF and not the size. The PDFs which I have used are as follows:
1. [arXiv:2510.19779](https://arxiv.org/abs/2510.19779)
contents: Images, Text, Tables, Formulae
Pages: 16
PDF size: 1.5 MB
VRAM USE: 3.3/3.4 GB
Processing Time: 40s

2. Gilbert Strang Linear Algebra and Its Applications (only 5 Pages of Chapter 1 sliced via print option i.e PDF only with 5 Pages)
contents: Images, Text, Formula Heavy.
Pages: 5
PDF size: 156 KB
VRAM USE: OOM
Processing Time: NA

3. Game of Thrones Book
contents: Text only
Pages: 750
PDF size: 1.5 MB
VRAM: 2.3/2.4 GB
Processing Time: 144s

### Steps to reproduce

##### Same code was used for all 3 PDFs

#### CODE:

from docling.document_converter import DocumentConverter, PdfFormatOption
from docling.datamodel.pipeline_options import PdfPipelineOptions
from docling.datamodel.base_models import InputFormat
import torch
import os

os.environ['PYTORCH_ALLOC_CONF'] = 'expandable_segments:True'
torch.cuda.empty_cache()

source = ""

pipeline_options = PdfPipelineOptions()
pipeline_options.do_formula_enrichment = True
pipeline_options.do_table_structure = True
pipeline_options.do_code_enrichment = False
pipeline_options.do_picture_classification = False
pipeline_options.do_picture_description = False
pipeline_options.do_ocr = False
pipeline_options.generate_parsed_pages = False

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

result = converter.convert(source)
doc = result.document
output_md = doc.export_to_markdown()

with open("temp.md", "w") as output:
output.write(output_md)

### Docling version

2025-10-25 11:03:06,223 - INFO - Loading plugin 'docling_defaults'
2025-10-25 11:03:06,226 - INFO - Registered ocr engines: ['auto', 'easyocr', 'ocrmac', 'rapidocr', 'tesserocr', 'tesseract']
Docling version: 2.58.0
Docling Core version: 2.49.0
Docling IBM Models version: 3.10.1
Docling Parse version: 4.7.0
Python: cpython-312 (3.12.3)
Platform: Linux-6.14.0-33-generic-x86_64-with-glibc2.39

### Python version

Python 3.12.3

### Specs:
OS: Ubuntu 24.04.3
RAM: 16 GB
GPU: GTX 1650 4GB Mobile Version

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.