mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-27 20:44:16 +00:00
Moved artifacts_path for SmolDocling into vlm_options instead of global pipeline option
Signed-off-by: Maksym Lysak <mly@zurich.ibm.com>
This commit is contained in:
parent
f2751e11f9
commit
7c4ab5c716
@ -30,7 +30,7 @@ class SmolDoclingModel(BasePageModel):
|
|||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
artifacts_path: Path,
|
# artifacts_path: Path,
|
||||||
accelerator_options: AcceleratorOptions,
|
accelerator_options: AcceleratorOptions,
|
||||||
vlm_options: SmolDoclingOptions,
|
vlm_options: SmolDoclingOptions,
|
||||||
):
|
):
|
||||||
@ -39,6 +39,7 @@ class SmolDoclingModel(BasePageModel):
|
|||||||
_log.info("Available device for SmolDocling: {}".format(device))
|
_log.info("Available device for SmolDocling: {}".format(device))
|
||||||
|
|
||||||
# PARAMETERS:
|
# PARAMETERS:
|
||||||
|
artifacts_path = Path(vlm_options.artifacts_path)
|
||||||
self.param_question = vlm_options.question # "Perform Layout Analysis."
|
self.param_question = vlm_options.question # "Perform Layout Analysis."
|
||||||
self.param_quantization_config = BitsAndBytesConfig(
|
self.param_quantization_config = BitsAndBytesConfig(
|
||||||
load_in_8bit=vlm_options.load_in_8bit, # True,
|
load_in_8bit=vlm_options.load_in_8bit, # True,
|
||||||
|
@ -45,10 +45,12 @@ class VlmPipeline(PaginatedPipeline):
|
|||||||
# force_backend_text = True - get text from backend using bounding boxes predicted by SmolDoclingss
|
# force_backend_text = True - get text from backend using bounding boxes predicted by SmolDoclingss
|
||||||
self.force_backend_text = pipeline_options.force_backend_text
|
self.force_backend_text = pipeline_options.force_backend_text
|
||||||
|
|
||||||
|
"""
|
||||||
if pipeline_options.artifacts_path is None:
|
if pipeline_options.artifacts_path is None:
|
||||||
self.artifacts_path = self.download_models_hf()
|
self.artifacts_path = self.download_models_hf()
|
||||||
else:
|
else:
|
||||||
self.artifacts_path = Path(pipeline_options.artifacts_path)
|
self.artifacts_path = Path(pipeline_options.artifacts_path)
|
||||||
|
"""
|
||||||
|
|
||||||
keep_images = (
|
keep_images = (
|
||||||
self.pipeline_options.generate_page_images
|
self.pipeline_options.generate_page_images
|
||||||
@ -58,7 +60,6 @@ class VlmPipeline(PaginatedPipeline):
|
|||||||
|
|
||||||
self.build_pipe = [
|
self.build_pipe = [
|
||||||
SmolDoclingModel(
|
SmolDoclingModel(
|
||||||
artifacts_path=self.artifacts_path,
|
|
||||||
accelerator_options=pipeline_options.accelerator_options,
|
accelerator_options=pipeline_options.accelerator_options,
|
||||||
vlm_options=self.pipeline_options.vlm_options,
|
vlm_options=self.pipeline_options.vlm_options,
|
||||||
),
|
),
|
||||||
|
@ -22,7 +22,6 @@ pipeline_options = PdfPipelineOptions()
|
|||||||
pipeline_options.generate_page_images = True
|
pipeline_options.generate_page_images = True
|
||||||
# If force_backend_text = True, text from backend will be used instead of generated text
|
# If force_backend_text = True, text from backend will be used instead of generated text
|
||||||
pipeline_options.force_backend_text = False
|
pipeline_options.force_backend_text = False
|
||||||
pipeline_options.artifacts_path = "model_artifacts/SmolDocling_2.7_DT_0.7"
|
|
||||||
|
|
||||||
vlm_options = SmolDoclingOptions(
|
vlm_options = SmolDoclingOptions(
|
||||||
artifacts_path="model_artifacts/SmolDocling_2.7_DT_0.7",
|
artifacts_path="model_artifacts/SmolDocling_2.7_DT_0.7",
|
||||||
|
Loading…
Reference in New Issue
Block a user