Skip to content

Multi GPU Support #2292

Description

@akhiljr10

Question

from docling.datamodel.base_models import InputFormat
from docling.document_extractor import DocumentExtractor, ExtractionFormatOption
from docling.datamodel.accelerator_options import AcceleratorOptions, AcceleratorDevice
from docling.datamodel.pipeline_options import VlmExtractionPipelineOptions
from docling.backend.pypdfium2_backend import PyPdfiumDocumentBackend
from docling.pipeline.extraction_vlm_pipeline import ExtractionVlmPipeline

pdf_options = AcceleratorOptions(num_threads=16, device=AcceleratorDevice.CUDA)

pdf_opt = ExtractionFormatOption(
    pipeline_cls=ExtractionVlmPipeline,
    pipeline_options=VlmExtractionPipelineOptions(accelerator_options=pdf_options),
    backend=PyPdfiumDocumentBackend
)

extractor = DocumentExtractor(
    allowed_formats=[InputFormat.PDF],
    extraction_format_options={InputFormat.PDF: pdf_opt}
)

I'm running this on virtual machine with 16 vCPUs, 104 GB RAM and 2 NVIDIA T4, and still running into error

Error processing page 1: CUDA out of memory. Tried to allocate 6.00 GiB. GPU 0 has a total capacity of 14.58 GiB of which 5.65 GiB is free. Including non-PyTorch memory, this process has 8.93 GiB memory in use. Of the allocated memory 8.73 GiB is allocated by PyTorch, and 74.44 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

Checking nvidia-smi shows that only one GPU is being used.

any suggestions or thoughts!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions