Updated naming

Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
This commit is contained in:
Christoph Auer 2025-07-08 13:07:56 +02:00
parent af0461e5b1
commit 517230b9c4
5 changed files with 19 additions and 23 deletions

View File

@ -29,42 +29,42 @@ class LayoutModelConfig(BaseModel):
# HuggingFace Layout Models
# Default Docling Layout Model
DOCLING_LAYOUT_V2 = LayoutModelConfig(
name="docling_layout_old",
docling_layout_v2 = LayoutModelConfig(
name="docling_layout_v2",
repo_id="ds4sd/docling-layout-old",
revision="main",
model_path="",
)
DOCLING_LAYOUT_HERON = LayoutModelConfig(
docling_layout_heron = LayoutModelConfig(
name="docling_layout_heron",
repo_id="ds4sd/docling-layout-heron",
revision="main",
model_path="",
)
DOCLING_LAYOUT_HERON_101 = LayoutModelConfig(
docling_layout_heron_101 = LayoutModelConfig(
name="docling_layout_heron_101",
repo_id="ds4sd/docling-layout-heron-101",
revision="main",
model_path="",
)
DOCLING_LAYOUT_EGRET_MEDIUM = LayoutModelConfig(
docling_layout_egret_medium = LayoutModelConfig(
name="docling_layout_egret_medium",
repo_id="ds4sd/docling-layout-egret-medium",
revision="main",
model_path="",
)
DOCLING_LAYOUT_EGRET_LARGE = LayoutModelConfig(
docling_layout_egret_large = LayoutModelConfig(
name="docling_layout_egret_large",
repo_id="ds4sd/docling-layout-egret-large",
revision="main",
model_path="",
)
DOCLING_LAYOUT_EGRET_XLARGE = LayoutModelConfig(
docling_layout_egret_xlarge = LayoutModelConfig(
name="docling_layout_egret_xlarge",
repo_id="ds4sd/docling-layout-egret-xlarge",
revision="main",
@ -82,7 +82,6 @@ DOCLING_LAYOUT_EGRET_XLARGE = LayoutModelConfig(
class LayoutModelType(str, Enum):
DOCLING_LAYOUT_V2 = "docling_layout_v2"
DOCLING_LAYOUT_OLD = "docling_layout_old"
DOCLING_LAYOUT_HERON = "docling_layout_heron"
DOCLING_LAYOUT_HERON_101 = "docling_layout_heron_101"
DOCLING_LAYOUT_EGRET_MEDIUM = "docling_layout_egret_medium"

View File

@ -17,13 +17,13 @@ from docling.datamodel import asr_model_specs
# Import the following for backwards compatibility
from docling.datamodel.accelerator_options import AcceleratorDevice, AcceleratorOptions
from docling.datamodel.layout_model_specs import (
DOCLING_LAYOUT_EGRET_LARGE,
DOCLING_LAYOUT_EGRET_MEDIUM,
DOCLING_LAYOUT_EGRET_XLARGE,
DOCLING_LAYOUT_HERON,
DOCLING_LAYOUT_HERON_101,
DOCLING_LAYOUT_V2,
LayoutModelConfig,
docling_layout_egret_large,
docling_layout_egret_medium,
docling_layout_egret_xlarge,
docling_layout_heron,
docling_layout_heron_101,
docling_layout_v2,
)
from docling.datamodel.pipeline_options_asr_model import (
InlineAsrOptions,
@ -279,7 +279,7 @@ class LayoutOptions(BaseModel):
"""Options for layout processing."""
create_orphan_clusters: bool = True # Whether to create clusters for orphaned cells
model: LayoutModelConfig = DOCLING_LAYOUT_V2
model_spec: LayoutModelConfig = docling_layout_v2
class AsrPipelineOptions(PipelineOptions):

View File

@ -12,7 +12,7 @@ from PIL import Image
from docling.datamodel.accelerator_options import AcceleratorOptions
from docling.datamodel.base_models import BoundingBox, Cluster, LayoutPrediction, Page
from docling.datamodel.document import ConversionResult
from docling.datamodel.layout_model_specs import DOCLING_LAYOUT_V2, LayoutModelConfig
from docling.datamodel.layout_model_specs import LayoutModelConfig, docling_layout_v2
from docling.datamodel.pipeline_options import LayoutOptions
from docling.datamodel.settings import settings
from docling.models.base_model import BasePageModel
@ -57,7 +57,7 @@ class LayoutModel(BasePageModel):
self.options = options
device = decide_device(accelerator_options.device)
layout_model_config = options.model
layout_model_config = options.model_spec
model_repo_folder = layout_model_config.model_repo_folder
model_path = layout_model_config.model_path
@ -91,7 +91,7 @@ class LayoutModel(BasePageModel):
local_dir: Optional[Path] = None,
force: bool = False,
progress: bool = False,
layout_model_config: LayoutModelConfig = DOCLING_LAYOUT_V2,
layout_model_config: LayoutModelConfig = docling_layout_v2,
) -> Path:
return download_hf_model(
repo_id=layout_model_config.repo_id,

View File

@ -37,9 +37,6 @@ _log = logging.getLogger(__name__)
class StandardPdfPipeline(PaginatedPipeline):
# _layout_model_path = LayoutModel._model_path
# _table_model_path = TableStructureModel._model_path
def __init__(self, pipeline_options: PdfPipelineOptions):
super().__init__(pipeline_options)
self.pipeline_options: PdfPipelineOptions

View File

@ -2,7 +2,7 @@ import logging
from pathlib import Path
from typing import Optional
from docling.datamodel.layout_model_specs import DOCLING_LAYOUT_V2
from docling.datamodel.layout_model_specs import docling_layout_v2
from docling.datamodel.pipeline_options import (
granite_picture_description,
smolvlm_picture_description,
@ -47,7 +47,7 @@ def download_models(
if with_layout:
_log.info("Downloading layout model...")
LayoutModel.download_models(
local_dir=output_dir / DOCLING_LAYOUT_V2.model_repo_folder,
local_dir=output_dir / docling_layout_v2.model_repo_folder,
force=force,
progress=progress,
)