Skip to content
Discussion options

You must be logged in to vote

You can control the number of worker threads (and device) in your Python code by passing an AcceleratorOptions instance to PdfPipelineOptions. Here’s how you can adapt your code:

import multiprocessing
from docling.datamodel.pipeline_options import PdfPipelineOptions, AcceleratorOptions
from docling.datamodel.base_models import InputFormat
from docling.document_converter import DocumentConverter, PdfFormatOption

pdf_options = PdfPipelineOptions(
    do_code_enrichment=True,
    do_ocr=True,
    do_table_structure=True,
    do_picture_classification=True,
    accelerator_options=AcceleratorOptions(
        num_threads=multiprocessing.cpu_count(),  # Use all CPU cores
        device='auto'  

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@enx-github
Comment options

@dosubot
Comment options

Answer selected by enx-github
@enx-github
Comment options

@enx-github
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant