From 768608351d40376c3504546f52e967195536b3d5 Mon Sep 17 00:00:00 2001 From: Iacopo Ghinassi <45108036+Ighina@users.noreply.github.com> Date: Sun, 19 Jan 2025 15:55:26 +0000 Subject: [PATCH] docs: fix correct Accelerator pipeline options in docs/examples/custom_convert.py (#733) * Update custom_convert.py Added the missing AcceleratorDevice and AcceleratorOptions functions in the imports and changed Device in the code to the correct AcceleratorDevice Signed-off-by: Iacopo Ghinassi <45108036+Ighina@users.noreply.github.com> * apply formatting Signed-off-by: Michele Dolfi --------- Signed-off-by: Iacopo Ghinassi <45108036+Ighina@users.noreply.github.com> Signed-off-by: Michele Dolfi Co-authored-by: Michele Dolfi --- docs/examples/custom_convert.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/examples/custom_convert.py b/docs/examples/custom_convert.py index a7efa97..49ab739 100644 --- a/docs/examples/custom_convert.py +++ b/docs/examples/custom_convert.py @@ -5,7 +5,11 @@ from pathlib import Path from docling.backend.pypdfium2_backend import PyPdfiumDocumentBackend from docling.datamodel.base_models import InputFormat -from docling.datamodel.pipeline_options import PdfPipelineOptions +from docling.datamodel.pipeline_options import ( + AcceleratorDevice, + AcceleratorOptions, + PdfPipelineOptions, +) from docling.document_converter import DocumentConverter, PdfFormatOption from docling.models.ocr_mac_model import OcrMacOptions from docling.models.tesseract_ocr_cli_model import TesseractCliOcrOptions @@ -76,7 +80,7 @@ def main(): pipeline_options.table_structure_options.do_cell_matching = True pipeline_options.ocr_options.lang = ["es"] pipeline_options.accelerator_options = AcceleratorOptions( - num_threads=4, device=Device.AUTO + num_threads=4, device=AcceleratorDevice.AUTO ) doc_converter = DocumentConverter(