merged with main and refactored the code to fix MyPy

Signed-off-by: Peter Staar <taa@zurich.ibm.com>
This commit is contained in:
Peter Staar 2025-07-10 09:58:06 +02:00
parent e596143bf8
commit 70872e6539
3 changed files with 15 additions and 4 deletions

View File

@ -14,6 +14,14 @@ from typing_extensions import deprecated
# Import the following for backwards compatibility
from docling.datamodel.accelerator_options import AcceleratorDevice, AcceleratorOptions
from docling.datamodel.asr_model_specs import (
WHISPER_BASE,
WHISPER_LARGE,
WHISPER_MEDIUM,
WHISPER_SMALL,
WHISPER_TINY,
WHISPER_TURBO,
)
from docling.datamodel.layout_model_specs import (
DOCLING_LAYOUT_EGRET_LARGE,
DOCLING_LAYOUT_EGRET_MEDIUM,

View File

@ -6,7 +6,10 @@ from pydantic import (
)
from docling.datamodel.accelerator_options import AcceleratorDevice
from docling.datamodel.layout_model_specs import docling_layout_heron
from docling.datamodel.layout_model_specs import (
DOCLING_LAYOUT_HERON,
DOCLING_LAYOUT_V2,
)
from docling.datamodel.pipeline_options_vlm_model import (
ApiVlmOptions,
InferenceFramework,
@ -140,7 +143,7 @@ GEMMA3_27B_MLX = InlineVlmOptions(
)
VLM2STAGE = TwoStageVlmOptions(
vlm_options=SMOLDOCLING_MLX, layout_options=docling_layout_heron
vlm_options=SMOLDOCLING_MLX, layout_options=DOCLING_LAYOUT_HERON
)

View File

@ -16,7 +16,7 @@ from docling.datamodel.document import ConversionResult
from docling.datamodel.layout_model_specs import DOCLING_LAYOUT_V2, LayoutModelConfig
from docling.datamodel.pipeline_options import LayoutOptions
from docling.datamodel.settings import settings
from docling.models.base_model import BaseLayoutModel
from docling.models.base_model import BaseLayoutModel, BasePageModel
from docling.models.utils.hf_model_download import download_hf_model
from docling.utils.accelerator_utils import decide_device
from docling.utils.layout_postprocessor import LayoutPostprocessor
@ -26,7 +26,7 @@ from docling.utils.visualization import draw_clusters
_log = logging.getLogger(__name__)
class LayoutModel(BasePageModel):
class LayoutModel(BaseLayoutModel):
TEXT_ELEM_LABELS = [
DocItemLabel.TEXT,
DocItemLabel.FOOTNOTE,