File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ from pathlib import Path
1818import docling
1919import qdrant_client
2020from docling .chunking import HybridChunker
21+ from docling .datamodel .accelerator_options import AcceleratorDevice , AcceleratorOptions
2122from docling .datamodel .base_models import InputFormat
2223from docling .datamodel .pipeline_options import PdfPipelineOptions
2324from docling .document_converter import DocumentConverter , PdfFormatOption
@@ -40,8 +41,14 @@ class Converter:
4041
4142 def __init__ (self , args ):
4243 # Docling Setup (Turn off OCR (image processing) for drastically reduced RAM usage and big speed increase)
43- pipeline_options = PdfPipelineOptions ()
44- pipeline_options .do_ocr = args .ocr
44+ if os .environ .get ("CUDA_VISIBLE_DEVICES" , "" ).lower () in ["" , "none" , "-1" ]:
45+ dev = AcceleratorDevice .CPU
46+ else :
47+ dev = AcceleratorDevice .CUDA
48+ pipeline_options = PdfPipelineOptions (
49+ accelerator_options = AcceleratorOptions (device = dev ),
50+ do_ocr = args .ocr ,
51+ )
4552 self .sources = []
4653 for source in args .sources :
4754 self .add (source )
You can’t perform that action at this time.
0 commit comments