From 8acd9aae4a18e3204088573d1769fba50a7bc875 Mon Sep 17 00:00:00 2001 From: Michele Dolfi Date: Tue, 11 Feb 2025 13:01:20 +0100 Subject: [PATCH] add check if artifacts_path exists and is dir Signed-off-by: Michele Dolfi --- docling/pipeline/standard_pdf_pipeline.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docling/pipeline/standard_pdf_pipeline.py b/docling/pipeline/standard_pdf_pipeline.py index 11466ec2..1c71bf7c 100644 --- a/docling/pipeline/standard_pdf_pipeline.py +++ b/docling/pipeline/standard_pdf_pipeline.py @@ -64,6 +64,12 @@ class StandardPdfPipeline(PaginatedPipeline): elif settings.artifacts_path is not None: artifacts_path = Path(settings.artifacts_path).expanduser() + if artifacts_path is not None and not artifacts_path.is_dir(): + raise RuntimeError( + f"The value of {artifacts_path=} is not valid. " + "When defined, it must point to a folder containing all models required by the pipeline." + ) + self.keep_images = ( self.pipeline_options.generate_page_images or self.pipeline_options.generate_picture_images