Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new torch-based docling models #120

Merged
merged 6 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docling/document_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ def download_models_hf(
from huggingface_hub import snapshot_download

download_path = snapshot_download(
repo_id="ds4sd/docling-models", force_download=force, local_dir=local_dir
repo_id="ds4sd/docling-models",
force_download=force,
local_dir=local_dir,
revision="v2.0.0",
)

return Path(download_path)
Expand Down
6 changes: 3 additions & 3 deletions docling/models/layout_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class LayoutModel:
"Page-footer",
"Code",
"List-item",
# "Title"
# "Formula",
]
PAGE_HEADER_LABELS = ["Page-header", "Page-footer"]
Expand Down Expand Up @@ -69,9 +70,7 @@ def postprocess(self, clusters: List[Cluster], cells: List[Cell], page_height):
"Key-Value Region": 0.45,
}

CLASS_REMAPPINGS = {
"Document Index": "Table",
}
CLASS_REMAPPINGS = {"Document Index": "Table", "Title": "Section-header"}

_log.debug("================= Start postprocess function ====================")
start_time = time.time()
Expand Down Expand Up @@ -277,6 +276,7 @@ def __call__(self, page_batch: Iterable[Page]) -> Iterable[Page]:
bbox=BoundingBox.model_validate(pred_item),
cells=[],
)

clusters.append(cluster)

# Map cells to clusters
Expand Down
2 changes: 1 addition & 1 deletion docling/pipeline/standard_model_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


class StandardModelPipeline(BaseModelPipeline):
_layout_model_path = "model_artifacts/layout/beehive_v0.0.5"
_layout_model_path = "model_artifacts/layout/beehive_v0.0.5_pt"
_table_model_path = "model_artifacts/tableformer"

def __init__(self, artifacts_path: Path, pipeline_options: PipelineOptions):
Expand Down
112 changes: 4 additions & 108 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ torchvision = [
python = "^3.10"
pydantic = "^2.0.0"
docling-core = "^1.6.2"
docling-ibm-models = "^1.3.1"
docling-ibm-models = "^2.0.0"
deepsearch-glm = "^0.22.0"
filetype = "^1.2.0"
pypdfium2 = "^4.30.0"
Expand Down
Loading
Loading