docling 2.35.0__py3-none-any.whl → 2.36.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- docling/backend/xml/jats_backend.py +0 -0
- docling/cli/main.py +12 -15
- docling/datamodel/accelerator_options.py +68 -0
- docling/datamodel/base_models.py +10 -8
- docling/datamodel/pipeline_options.py +29 -161
- docling/datamodel/pipeline_options_vlm_model.py +81 -0
- docling/datamodel/vlm_model_specs.py +144 -0
- docling/document_converter.py +5 -0
- docling/models/api_vlm_model.py +1 -1
- docling/models/base_ocr_model.py +2 -1
- docling/models/code_formula_model.py +6 -11
- docling/models/document_picture_classifier.py +6 -11
- docling/models/easyocr_model.py +1 -2
- docling/models/layout_model.py +6 -11
- docling/models/ocr_mac_model.py +1 -1
- docling/models/picture_description_api_model.py +1 -1
- docling/models/picture_description_base_model.py +1 -1
- docling/models/picture_description_vlm_model.py +7 -22
- docling/models/rapid_ocr_model.py +1 -2
- docling/models/table_structure_model.py +6 -12
- docling/models/tesseract_ocr_cli_model.py +1 -1
- docling/models/tesseract_ocr_model.py +1 -1
- docling/models/utils/__init__.py +0 -0
- docling/models/utils/hf_model_download.py +40 -0
- docling/models/vlm_models_inline/__init__.py +0 -0
- docling/models/vlm_models_inline/hf_transformers_model.py +194 -0
- docling/models/{hf_mlx_model.py → vlm_models_inline/mlx_model.py} +56 -44
- docling/pipeline/vlm_pipeline.py +228 -61
- docling/utils/accelerator_utils.py +17 -2
- docling/utils/model_downloader.py +13 -12
- {docling-2.35.0.dist-info → docling-2.36.1.dist-info}/METADATA +53 -55
- {docling-2.35.0.dist-info → docling-2.36.1.dist-info}/RECORD +46 -39
- {docling-2.35.0.dist-info → docling-2.36.1.dist-info}/WHEEL +2 -1
- docling-2.36.1.dist-info/entry_points.txt +6 -0
- docling-2.36.1.dist-info/top_level.txt +1 -0
- docling/models/hf_vlm_model.py +0 -182
- docling-2.35.0.dist-info/entry_points.txt +0 -7
- {docling-2.35.0.dist-info → docling-2.36.1.dist-info/licenses}/LICENSE +0 -0
@@ -1,67 +1,67 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: docling
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.36.1
|
4
4
|
Summary: SDK and CLI for parsing PDF, DOCX, HTML, and more, to a unified document representation for powering downstream workflows such as gen AI applications.
|
5
|
-
|
6
|
-
License: MIT
|
5
|
+
Author-email: Christoph Auer <cau@zurich.ibm.com>, Michele Dolfi <dol@zurich.ibm.com>, Maxim Lysak <mly@zurich.ibm.com>, Nikos Livathinos <nli@zurich.ibm.com>, Ahmed Nassar <ahn@zurich.ibm.com>, Panos Vagenas <pva@zurich.ibm.com>, Peter Staar <taa@zurich.ibm.com>
|
6
|
+
License-Expression: MIT
|
7
|
+
Project-URL: homepage, https://github.com/docling-project/docling
|
8
|
+
Project-URL: repository, https://github.com/docling-project/docling
|
9
|
+
Project-URL: issues, https://github.com/docling-project/docling/issues
|
10
|
+
Project-URL: changelog, https://github.com/docling-project/docling/blob/main/CHANGELOG.md
|
7
11
|
Keywords: docling,convert,document,pdf,docx,html,markdown,layout model,segmentation,table structure,table former
|
8
|
-
|
9
|
-
|
10
|
-
|
12
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
13
|
+
Classifier: Operating System :: POSIX :: Linux
|
14
|
+
Classifier: Operating System :: Microsoft :: Windows
|
11
15
|
Classifier: Development Status :: 5 - Production/Stable
|
12
16
|
Classifier: Intended Audience :: Developers
|
13
17
|
Classifier: Intended Audience :: Science/Research
|
14
|
-
Classifier:
|
15
|
-
Classifier: Operating System :: MacOS :: MacOS X
|
16
|
-
Classifier: Operating System :: POSIX :: Linux
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
17
19
|
Classifier: Programming Language :: Python :: 3
|
18
20
|
Classifier: Programming Language :: Python :: 3.9
|
19
21
|
Classifier: Programming Language :: Python :: 3.10
|
20
22
|
Classifier: Programming Language :: Python :: 3.11
|
21
23
|
Classifier: Programming Language :: Python :: 3.12
|
22
24
|
Classifier: Programming Language :: Python :: 3.13
|
23
|
-
|
24
|
-
|
25
|
-
|
25
|
+
Requires-Python: <4.0,>=3.9
|
26
|
+
Description-Content-Type: text/markdown
|
27
|
+
License-File: LICENSE
|
28
|
+
Requires-Dist: pydantic<3.0.0,>=2.0.0
|
29
|
+
Requires-Dist: docling-core[chunking]<3.0.0,>=2.29.0
|
30
|
+
Requires-Dist: docling-ibm-models<4.0.0,>=3.4.4
|
31
|
+
Requires-Dist: docling-parse<5.0.0,>=4.0.0
|
32
|
+
Requires-Dist: filetype<2.0.0,>=1.2.0
|
33
|
+
Requires-Dist: pypdfium2<5.0.0,>=4.30.0
|
34
|
+
Requires-Dist: pydantic-settings<3.0.0,>=2.3.0
|
35
|
+
Requires-Dist: huggingface_hub<1,>=0.23
|
36
|
+
Requires-Dist: requests<3.0.0,>=2.32.2
|
37
|
+
Requires-Dist: easyocr<2.0,>=1.7
|
38
|
+
Requires-Dist: certifi>=2024.7.4
|
39
|
+
Requires-Dist: rtree<2.0.0,>=1.3.0
|
40
|
+
Requires-Dist: typer<0.17.0,>=0.12.5
|
41
|
+
Requires-Dist: python-docx<2.0.0,>=1.1.2
|
42
|
+
Requires-Dist: python-pptx<2.0.0,>=1.0.2
|
43
|
+
Requires-Dist: beautifulsoup4<5.0.0,>=4.12.3
|
44
|
+
Requires-Dist: pandas<3.0.0,>=2.1.4
|
45
|
+
Requires-Dist: marko<3.0.0,>=2.1.2
|
46
|
+
Requires-Dist: openpyxl<4.0.0,>=3.1.5
|
47
|
+
Requires-Dist: lxml<6.0.0,>=4.0.0
|
48
|
+
Requires-Dist: pillow<12.0.0,>=10.0.0
|
49
|
+
Requires-Dist: tqdm<5.0.0,>=4.65.0
|
50
|
+
Requires-Dist: pluggy<2.0.0,>=1.0.0
|
51
|
+
Requires-Dist: pylatexenc<3.0,>=2.10
|
52
|
+
Requires-Dist: scipy<2.0.0,>=1.6.0
|
26
53
|
Provides-Extra: tesserocr
|
54
|
+
Requires-Dist: tesserocr<3.0.0,>=2.7.1; extra == "tesserocr"
|
55
|
+
Provides-Extra: ocrmac
|
56
|
+
Requires-Dist: ocrmac<2.0.0,>=1.0.0; sys_platform == "darwin" and extra == "ocrmac"
|
27
57
|
Provides-Extra: vlm
|
28
|
-
Requires-Dist:
|
29
|
-
Requires-Dist:
|
30
|
-
Requires-Dist:
|
31
|
-
|
32
|
-
Requires-Dist:
|
33
|
-
Requires-Dist:
|
34
|
-
|
35
|
-
Requires-Dist: easyocr (>=1.7,<2.0)
|
36
|
-
Requires-Dist: filetype (>=1.2.0,<2.0.0)
|
37
|
-
Requires-Dist: huggingface_hub (>=0.23,<1)
|
38
|
-
Requires-Dist: lxml (>=4.0.0,<6.0.0)
|
39
|
-
Requires-Dist: marko (>=2.1.2,<3.0.0)
|
40
|
-
Requires-Dist: ocrmac (>=1.0.0,<2.0.0) ; (sys_platform == "darwin") and (extra == "ocrmac")
|
41
|
-
Requires-Dist: onnxruntime (>=1.7.0,<1.20.0) ; (python_version < "3.10") and (extra == "rapidocr")
|
42
|
-
Requires-Dist: onnxruntime (>=1.7.0,<2.0.0) ; (python_version >= "3.10") and (extra == "rapidocr")
|
43
|
-
Requires-Dist: openpyxl (>=3.1.5,<4.0.0)
|
44
|
-
Requires-Dist: pandas (>=2.1.4,<3.0.0)
|
45
|
-
Requires-Dist: pillow (>=10.0.0,<12.0.0)
|
46
|
-
Requires-Dist: pluggy (>=1.0.0,<2.0.0)
|
47
|
-
Requires-Dist: pydantic (>=2.0.0,<3.0.0)
|
48
|
-
Requires-Dist: pydantic-settings (>=2.3.0,<3.0.0)
|
49
|
-
Requires-Dist: pylatexenc (>=2.10,<3.0)
|
50
|
-
Requires-Dist: pypdfium2 (>=4.30.0,<5.0.0)
|
51
|
-
Requires-Dist: python-docx (>=1.1.2,<2.0.0)
|
52
|
-
Requires-Dist: python-pptx (>=1.0.2,<2.0.0)
|
53
|
-
Requires-Dist: rapidocr-onnxruntime (>=1.4.0,<2.0.0) ; (python_version < "3.13") and (extra == "rapidocr")
|
54
|
-
Requires-Dist: requests (>=2.32.2,<3.0.0)
|
55
|
-
Requires-Dist: rtree (>=1.3.0,<2.0.0)
|
56
|
-
Requires-Dist: scipy (>=1.6.0,<1.14.0) ; python_version < "3.10"
|
57
|
-
Requires-Dist: scipy (>=1.6.0,<2.0.0) ; python_version >= "3.10"
|
58
|
-
Requires-Dist: tesserocr (>=2.7.1,<3.0.0) ; extra == "tesserocr"
|
59
|
-
Requires-Dist: tqdm (>=4.65.0,<5.0.0)
|
60
|
-
Requires-Dist: transformers (>=4.42.0,<4.43.0) ; (sys_platform == "darwin" and platform_machine == "x86_64") and (extra == "vlm")
|
61
|
-
Requires-Dist: transformers (>=4.46.0,<5.0.0) ; (sys_platform != "darwin" or platform_machine != "x86_64") and (extra == "vlm")
|
62
|
-
Requires-Dist: typer (>=0.12.5,<0.16.0)
|
63
|
-
Project-URL: Repository, https://github.com/docling-project/docling
|
64
|
-
Description-Content-Type: text/markdown
|
58
|
+
Requires-Dist: transformers<5.0.0,>=4.46.0; extra == "vlm"
|
59
|
+
Requires-Dist: accelerate<2.0.0,>=1.2.1; extra == "vlm"
|
60
|
+
Requires-Dist: mlx-vlm>=0.1.22; (python_version >= "3.10" and sys_platform == "darwin" and platform_machine == "arm64") and extra == "vlm"
|
61
|
+
Provides-Extra: rapidocr
|
62
|
+
Requires-Dist: rapidocr-onnxruntime<2.0.0,>=1.4.0; python_version < "3.13" and extra == "rapidocr"
|
63
|
+
Requires-Dist: onnxruntime<2.0.0,>=1.7.0; extra == "rapidocr"
|
64
|
+
Dynamic: license-file
|
65
65
|
|
66
66
|
<p align="center">
|
67
67
|
<a href="https://github.com/docling-project/docling">
|
@@ -79,9 +79,8 @@ Description-Content-Type: text/markdown
|
|
79
79
|
[](https://docling-project.github.io/docling/)
|
80
80
|
[](https://pypi.org/project/docling/)
|
81
81
|
[](https://pypi.org/project/docling/)
|
82
|
-
[](https://pycqa.github.io/isort/)
|
82
|
+
[](https://github.com/astral-sh/uv)
|
83
|
+
[](https://github.com/astral-sh/ruff)
|
85
84
|
[](https://pydantic.dev)
|
86
85
|
[](https://github.com/pre-commit/pre-commit)
|
87
86
|
[](https://opensource.org/licenses/MIT)
|
@@ -101,7 +100,7 @@ Docling simplifies document processing, parsing diverse formats — including ad
|
|
101
100
|
* 🔒 Local execution capabilities for sensitive data and air-gapped environments
|
102
101
|
* 🤖 Plug-and-play [integrations][integrations] incl. LangChain, LlamaIndex, Crew AI & Haystack for agentic AI
|
103
102
|
* 🔍 Extensive OCR support for scanned PDFs and images
|
104
|
-
* 🥚 Support of Visual Language Models ([SmolDocling](https://huggingface.co/ds4sd/SmolDocling-256M-preview))
|
103
|
+
* 🥚 Support of several Visual Language Models ([SmolDocling](https://huggingface.co/ds4sd/SmolDocling-256M-preview))
|
105
104
|
* 💻 Simple and convenient CLI
|
106
105
|
|
107
106
|
### Coming soon
|
@@ -214,4 +213,3 @@ The project was started by the AI for knowledge team at IBM Research Zurich.
|
|
214
213
|
[supported_formats]: https://docling-project.github.io/docling/usage/supported_formats/
|
215
214
|
[docling_document]: https://docling-project.github.io/docling/concepts/docling_document/
|
216
215
|
[integrations]: https://docling-project.github.io/docling/integrations/
|
217
|
-
|
@@ -1,4 +1,7 @@
|
|
1
1
|
docling/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
docling/document_converter.py,sha256=bnUA9k1LCuCfNwCsneGQiGCvFdnX8W-vbpnu6U_fuuI,14003
|
3
|
+
docling/exceptions.py,sha256=K1WnCS1leK2JtMB5ewZWKkb0EaijFgl-tRzrO9ntgPM,134
|
4
|
+
docling/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
2
5
|
docling/backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
6
|
docling/backend/abstract_backend.py,sha256=1lNxzwDTn303aXduPDVmTyXn-5ZIoWMLYqNxANGWmQQ,1658
|
4
7
|
docling/backend/asciidoc_backend.py,sha256=W-4MRcID6AU9Ax23q8FwDwGG-OOCrBoqcNf2Ch_WPUc,14041
|
@@ -6,82 +9,86 @@ docling/backend/csv_backend.py,sha256=2g9famYG2W-ID9jEdZPxc6O8QGv1vWQfjN8pL-QMBE
|
|
6
9
|
docling/backend/docling_parse_backend.py,sha256=bVSPmmiVXdCVfe-eLtDhbPQKBjkFR8rZJoRxdWIMdYU,7998
|
7
10
|
docling/backend/docling_parse_v2_backend.py,sha256=R4YPCEs72GYg-Xc9VfizPv8QjtGmKOsQzVPNAU2RIK0,9376
|
8
11
|
docling/backend/docling_parse_v4_backend.py,sha256=aWh-fd-lnuRGVGC_DG17QUptIsArv5V1gJo8QFbB5Ys,6263
|
9
|
-
docling/backend/docx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
docling/backend/docx/latex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
-
docling/backend/docx/latex/latex_dict.py,sha256=tFJp4ScT_AkY2ON7nLEa560p601Jq2glcZvMKxxjn7w,6593
|
12
|
-
docling/backend/docx/latex/omml.py,sha256=nEpcfyyrOucJyj6cD7wfThrIa-q0CQCoqMb3dkrhCRg,12094
|
13
12
|
docling/backend/html_backend.py,sha256=3K-l5SUAAyqISNEb7nPst_I51xzYOVOkgmwXh3lv9sw,21063
|
14
|
-
docling/backend/json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
|
-
docling/backend/json/docling_json_backend.py,sha256=LlFMVoZrrCfVwbDuRbNN4Xg96Lujh4xxrTBt9jGhY9I,1984
|
16
13
|
docling/backend/md_backend.py,sha256=JkY1qTvQFXjKSZGfD-83d-fZelorUG_l6mpJdYGqvX8,17210
|
17
14
|
docling/backend/msexcel_backend.py,sha256=3j0WQfqDpgPXdPMCguefdv7arcNVDedPD6gl54cmLn8,18110
|
18
15
|
docling/backend/mspowerpoint_backend.py,sha256=RwqfvvzrtM56L9uf7PR9lvlHJ-LyYGpkS1iVxkTl72Q,17203
|
19
16
|
docling/backend/msword_backend.py,sha256=iB2yRg8hXtET2-Wjkv5pq0p9Y1SGQYIVCcWtOtXUILU,44621
|
20
17
|
docling/backend/pdf_backend.py,sha256=KE9TMuFO5WX-o5A_DAd4tEaLi4HMZ4XjKdpllItVkWM,2238
|
21
18
|
docling/backend/pypdfium2_backend.py,sha256=fUGRBupwTYftEgdIDWKphA2zdfb-SrUoUGENK6j-q-0,11002
|
19
|
+
docling/backend/docx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
|
+
docling/backend/docx/latex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
|
+
docling/backend/docx/latex/latex_dict.py,sha256=tFJp4ScT_AkY2ON7nLEa560p601Jq2glcZvMKxxjn7w,6593
|
22
|
+
docling/backend/docx/latex/omml.py,sha256=nEpcfyyrOucJyj6cD7wfThrIa-q0CQCoqMb3dkrhCRg,12094
|
23
|
+
docling/backend/json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
|
+
docling/backend/json/docling_json_backend.py,sha256=LlFMVoZrrCfVwbDuRbNN4Xg96Lujh4xxrTBt9jGhY9I,1984
|
22
25
|
docling/backend/xml/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
23
26
|
docling/backend/xml/jats_backend.py,sha256=ghGi9bHjx3BvaOtmzLw86-wZy4UxpQPOPQL4e73-BI8,24927
|
24
27
|
docling/backend/xml/uspto_backend.py,sha256=nyAMr5ht7dclxkVDwsKNeiOhLQrUtRLS8JdscB2AVJg,70924
|
25
28
|
docling/chunking/__init__.py,sha256=h83TDs0AuOV6oEPLAPrn9dpGKiU-2Vg6IRNo4cv6GDA,346
|
26
29
|
docling/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
27
|
-
docling/cli/main.py,sha256=
|
30
|
+
docling/cli/main.py,sha256=fDGjepShl6KO_BdA6qUNyNBoCjqZUKRnmmkzesGtvVU,27202
|
28
31
|
docling/cli/models.py,sha256=9yLGp6QRJGpR86U3SjmWAXDt3MvBaJLLY4xDVdsu3O8,4160
|
29
32
|
docling/cli/tools.py,sha256=QhtRxQG0TVrfsMqdv5i7J0_qQy1ZZyWYnHPwJl7b5oY,322
|
30
33
|
docling/datamodel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
|
-
docling/datamodel/
|
34
|
+
docling/datamodel/accelerator_options.py,sha256=wv6dOFTVAwr9onkE-0pfUqX_fDb6gX53iPPE6o8nKjI,2511
|
35
|
+
docling/datamodel/base_models.py,sha256=bkooSG4brZy2jt2dndkin3DHvfZ5HFp0C94yBGmCWeI,10568
|
32
36
|
docling/datamodel/document.py,sha256=vPwiVU5zWCKbVYMq-TSmb7LTjijrqJq0FyAgDBa0XGA,16154
|
33
|
-
docling/datamodel/pipeline_options.py,sha256=
|
37
|
+
docling/datamodel/pipeline_options.py,sha256=iMuwsa77hkAgjJWXBRAFEQGw9tGNMDQrPnSvE5mirNs,9081
|
38
|
+
docling/datamodel/pipeline_options_vlm_model.py,sha256=-ZPAp2uSKMatDbjZPv9chT587B1aftfDVmi_FDb2aw8,1997
|
34
39
|
docling/datamodel/settings.py,sha256=ajMz7Ao2m0ZGYkfArqTDDbiF89O408mtgeh06PUi0MA,1900
|
35
|
-
docling/
|
36
|
-
docling/exceptions.py,sha256=K1WnCS1leK2JtMB5ewZWKkb0EaijFgl-tRzrO9ntgPM,134
|
40
|
+
docling/datamodel/vlm_model_specs.py,sha256=--jZexGeu-s_lWp7y_WwWEf6CD1J4XqADrS1-OY_pWM,4737
|
37
41
|
docling/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
38
|
-
docling/models/api_vlm_model.py,sha256=
|
42
|
+
docling/models/api_vlm_model.py,sha256=w3P1wOsr3JvZsawbK1Z4uwnD5ehUMbcKGkyhcX83Okc,2738
|
39
43
|
docling/models/base_model.py,sha256=Zx_nByGYkubTvvYiQxwiB6P8lc7wOD4ZTC2QIw6vCEg,2950
|
40
|
-
docling/models/base_ocr_model.py,sha256=
|
41
|
-
docling/models/code_formula_model.py,sha256=
|
42
|
-
docling/models/document_picture_classifier.py,sha256=
|
43
|
-
docling/models/easyocr_model.py,sha256=
|
44
|
+
docling/models/base_ocr_model.py,sha256=c6a2QzZnAMfQECQDz1JASecl_Z2F3i6P3ax6kHWcz6o,7221
|
45
|
+
docling/models/code_formula_model.py,sha256=5uWh-eI-Ejmv3DujKJoKKgJBuvPLokt7AJ_ybt8VHEw,11373
|
46
|
+
docling/models/document_picture_classifier.py,sha256=fkJLV7pMy3v6iNwOzVb6zdBU1dGtBM1ARHLIRPfoAG4,6124
|
47
|
+
docling/models/easyocr_model.py,sha256=bTK-AQYc-WTzX8SRoMRwVjqlMigaJKGloaLUcH6RCKU,7406
|
48
|
+
docling/models/layout_model.py,sha256=KdGhS4EMWKP6BwlhUJ0mdbhk2Fc78qwzqEZbTxyrbFM,8508
|
49
|
+
docling/models/ocr_mac_model.py,sha256=CJOwz9h84crvZd3kQMLxYntpXz-1w2eLDjhGUnGIwMQ,5415
|
50
|
+
docling/models/page_assemble_model.py,sha256=TvN1naez7dUodLxpUUBzpuMCpqZBTf6YSpewxgjzmrg,6323
|
51
|
+
docling/models/page_preprocessing_model.py,sha256=8cdhR9n3zcC8JxDen8WdPBx_GNk_5VICeHJo1-kP518,5186
|
52
|
+
docling/models/picture_description_api_model.py,sha256=o3EkV5aHW_6WzE_fdj_VRnNCrS_btclO_ZCLAUqrfl0,2377
|
53
|
+
docling/models/picture_description_base_model.py,sha256=kLthLhdlgwhootQ4_xhhcAk6A-vso5-qcsFJ3TcYfO0,2991
|
54
|
+
docling/models/picture_description_vlm_model.py,sha256=7LeCx9ZdPxsmWJ468OtxCdAkH48A1HD0iwH9cs_7-1Q,3800
|
55
|
+
docling/models/rapid_ocr_model.py,sha256=miTPn1YTWKtXUuddiVv0SjgkuNWHXCW3CZ6epDUmKjI,5935
|
56
|
+
docling/models/readingorder_model.py,sha256=S9ru2ApY9sE-Uue3hptWHmbmElwo36bUbAikxCFpHYs,14574
|
57
|
+
docling/models/table_structure_model.py,sha256=dQf6u_zn5fHCkHzmTwYfCbRtZCBddsyAM0WNVBUUQzk,12473
|
58
|
+
docling/models/tesseract_ocr_cli_model.py,sha256=oQZVWXQ6wRrFonRFwbWeW9nJ9FLQZdzSWErOp0mEff0,12698
|
59
|
+
docling/models/tesseract_ocr_model.py,sha256=AjrZNwgVbV0IbzBJwI35YP0KxvqWJWJE0v_lgHJiQrk,10606
|
44
60
|
docling/models/factories/__init__.py,sha256=x_EM5dDg_A3HBcBYzOoqwmA2AFLtJ1IzYDPX-R1A-Sg,868
|
45
61
|
docling/models/factories/base_factory.py,sha256=MfWIljMETi5aaVR-6qLTelW8u1gwDAQsOwg3fu7O4Qc,4028
|
46
62
|
docling/models/factories/ocr_factory.py,sha256=G5RkmkKvkl-ihpo6qSj8WC77VdlVSQ1s0ekwUX2ILts,316
|
47
63
|
docling/models/factories/picture_description_factory.py,sha256=Ru3-TnVVEKf5O07C_UpGf2HCOHc7j20AJzfficw3agM,385
|
48
|
-
docling/models/hf_mlx_model.py,sha256=B_B4hFU-jU0g_DQtQD8w4Ejorn10mkDuFI93wR_WhGk,4897
|
49
|
-
docling/models/hf_vlm_model.py,sha256=SiPMTLghMUjJ66dA2yN4UujpLO6PiOhLEPInWtXV_5s,6912
|
50
|
-
docling/models/layout_model.py,sha256=1LLDS3hBfdJXA16L_PrjA_1rM_A2r5rNFkHVbLBCl_8,8639
|
51
|
-
docling/models/ocr_mac_model.py,sha256=A3TlEbvvwhkWiq9YARos3Y9yNcpPYQ7JGc_4hFtAK-8,5370
|
52
|
-
docling/models/page_assemble_model.py,sha256=TvN1naez7dUodLxpUUBzpuMCpqZBTf6YSpewxgjzmrg,6323
|
53
|
-
docling/models/page_preprocessing_model.py,sha256=8cdhR9n3zcC8JxDen8WdPBx_GNk_5VICeHJo1-kP518,5186
|
54
|
-
docling/models/picture_description_api_model.py,sha256=kCuAFOGEuI5QsRul7Pc1LccxWN7WIvIUhXEmSICYegw,2332
|
55
|
-
docling/models/picture_description_base_model.py,sha256=FbBVXzAOB87xpJN28tuGCxoAdcf6mZNUOqJR7ljUg5g,2946
|
56
|
-
docling/models/picture_description_vlm_model.py,sha256=DiTjnehVy1n0N04xPUvZl8rx4TiNHzHn9Cnzy_ePGts,4177
|
57
64
|
docling/models/plugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
58
65
|
docling/models/plugins/defaults.py,sha256=qslXGnRX07Z3GGttNriqaox0v0vXp4zs4KLurHCZjp4,858
|
59
|
-
docling/models/
|
60
|
-
docling/models/
|
61
|
-
docling/models/
|
62
|
-
docling/models/
|
63
|
-
docling/models/
|
66
|
+
docling/models/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
67
|
+
docling/models/utils/hf_model_download.py,sha256=scBEfsM4yl7xPzqe7UtPvDh9RfQZQnuOhqQKilYBHls,984
|
68
|
+
docling/models/vlm_models_inline/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
69
|
+
docling/models/vlm_models_inline/hf_transformers_model.py,sha256=SXSu6spu8zNCsrD32RU_irLs59ltF6PqbLVfpjDujmE,7285
|
70
|
+
docling/models/vlm_models_inline/mlx_model.py,sha256=CFe1UNxQufZd5K4iaOW3HsplQBPb_1cENf3KIwWUSWw,5702
|
64
71
|
docling/pipeline/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
65
72
|
docling/pipeline/base_pipeline.py,sha256=DnuxAf7EQusdSRae0QUVth-0f2mSff8JZjX-2vazk00,8751
|
66
73
|
docling/pipeline/simple_pipeline.py,sha256=TXZOwR7hZRji462ZTIpte0VJjzbxvNVE8dbLFANDhSU,2253
|
67
74
|
docling/pipeline/standard_pdf_pipeline.py,sha256=itCZPj7nMFAQtAlStfmWthpCIHZFUm9W5uTgvVi6PkQ,12738
|
68
|
-
docling/pipeline/vlm_pipeline.py,sha256=
|
69
|
-
docling/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
75
|
+
docling/pipeline/vlm_pipeline.py,sha256=IrjDbajCPmUPep_jATKNiABST4tQ8mvpkQz9mtBQ8qQ,15279
|
70
76
|
docling/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
71
|
-
docling/utils/accelerator_utils.py,sha256=
|
77
|
+
docling/utils/accelerator_utils.py,sha256=Fww4UiTiuIB91iuPgUZTy-DYpCGRMI8YuCYKhFb0gjA,2905
|
72
78
|
docling/utils/api_image_request.py,sha256=_CgdzmPqdsyXmyYUFGLZcXcoH586qC6A1p5vsNbj1Q0,1416
|
73
79
|
docling/utils/export.py,sha256=VwVUnYDk3mhGmISDbVm306fwpGNnoojouStBD4UajXI,4673
|
74
80
|
docling/utils/glm_utils.py,sha256=TKOWQqWAHsX_w4fvoAA7_2xCi_urhnp1DsmjY8_sk5w,12274
|
75
81
|
docling/utils/layout_postprocessor.py,sha256=3WCmkPsPJ80xfWzAUeWb5L9BmuwJ79ztctvbbUs8AfI,24068
|
76
82
|
docling/utils/locks.py,sha256=RzqQtD5UispgV71pGN_nU6GYfeN11BN0Sh_Dq9ycqGo,52
|
77
|
-
docling/utils/model_downloader.py,sha256=
|
83
|
+
docling/utils/model_downloader.py,sha256=6TDxFOvMRYT8JyYyaQS_wXMJzNga61ImY3sFdks66qM,4004
|
78
84
|
docling/utils/ocr_utils.py,sha256=AOaDAHr5S74d-IRVR_LKhKynUTIurAwLJ3wNeY58gPA,2326
|
79
85
|
docling/utils/orientation.py,sha256=xXlOfowL54FKwjsTFrM7y3ogk1wChLNn_-u74tYIf1s,2011
|
80
86
|
docling/utils/profiling.py,sha256=YaMGoB9MMZpagF9mb5ndoHj8Lpb9aIdb7El-Pl7IcFs,1753
|
81
87
|
docling/utils/utils.py,sha256=kJtIYuzXeOyJHYlxmLAo7dGM5rEsDa1i84qEsUj1nio,1908
|
82
88
|
docling/utils/visualization.py,sha256=tY2ylE2aiQKkmzlSLnFW-HTfFyqUUMguW18ldd1PLfo,2868
|
83
|
-
docling-2.
|
84
|
-
docling-2.
|
85
|
-
docling-2.
|
86
|
-
docling-2.
|
87
|
-
docling-2.
|
89
|
+
docling-2.36.1.dist-info/licenses/LICENSE,sha256=mBb7ErEcM8VS9OhiGHnQ2kk75HwPhr54W1Oiz3965MY,1088
|
90
|
+
docling-2.36.1.dist-info/METADATA,sha256=0Sl0LfCopUXdEd6mm2kqRpMgFoq6nvZBUXlIKeIqY_E,10036
|
91
|
+
docling-2.36.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
92
|
+
docling-2.36.1.dist-info/entry_points.txt,sha256=hzVlbeE0aMSTQ9S0-NTYN0Hmgsn6qL_EA2qX4UbkAuY,149
|
93
|
+
docling-2.36.1.dist-info/top_level.txt,sha256=vkIywP-USjFyYo1AIRQbWQQaL3xB5jf8vkCYdTIfNic,8
|
94
|
+
docling-2.36.1.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
docling
|
docling/models/hf_vlm_model.py
DELETED
@@ -1,182 +0,0 @@
|
|
1
|
-
import logging
|
2
|
-
import time
|
3
|
-
from collections.abc import Iterable
|
4
|
-
from pathlib import Path
|
5
|
-
from typing import Optional
|
6
|
-
|
7
|
-
from docling.datamodel.base_models import Page, VlmPrediction
|
8
|
-
from docling.datamodel.document import ConversionResult
|
9
|
-
from docling.datamodel.pipeline_options import (
|
10
|
-
AcceleratorOptions,
|
11
|
-
HuggingFaceVlmOptions,
|
12
|
-
)
|
13
|
-
from docling.models.base_model import BasePageModel
|
14
|
-
from docling.utils.accelerator_utils import decide_device
|
15
|
-
from docling.utils.profiling import TimeRecorder
|
16
|
-
|
17
|
-
_log = logging.getLogger(__name__)
|
18
|
-
|
19
|
-
|
20
|
-
class HuggingFaceVlmModel(BasePageModel):
|
21
|
-
def __init__(
|
22
|
-
self,
|
23
|
-
enabled: bool,
|
24
|
-
artifacts_path: Optional[Path],
|
25
|
-
accelerator_options: AcceleratorOptions,
|
26
|
-
vlm_options: HuggingFaceVlmOptions,
|
27
|
-
):
|
28
|
-
self.enabled = enabled
|
29
|
-
|
30
|
-
self.vlm_options = vlm_options
|
31
|
-
|
32
|
-
if self.enabled:
|
33
|
-
import torch
|
34
|
-
from transformers import ( # type: ignore
|
35
|
-
AutoModelForVision2Seq,
|
36
|
-
AutoProcessor,
|
37
|
-
BitsAndBytesConfig,
|
38
|
-
)
|
39
|
-
|
40
|
-
device = decide_device(accelerator_options.device)
|
41
|
-
self.device = device
|
42
|
-
|
43
|
-
_log.debug(f"Available device for HuggingFace VLM: {device}")
|
44
|
-
|
45
|
-
repo_cache_folder = vlm_options.repo_id.replace("/", "--")
|
46
|
-
|
47
|
-
# PARAMETERS:
|
48
|
-
if artifacts_path is None:
|
49
|
-
artifacts_path = self.download_models(self.vlm_options.repo_id)
|
50
|
-
elif (artifacts_path / repo_cache_folder).exists():
|
51
|
-
artifacts_path = artifacts_path / repo_cache_folder
|
52
|
-
|
53
|
-
self.param_question = vlm_options.prompt # "Perform Layout Analysis."
|
54
|
-
self.param_quantization_config = BitsAndBytesConfig(
|
55
|
-
load_in_8bit=vlm_options.load_in_8bit, # True,
|
56
|
-
llm_int8_threshold=vlm_options.llm_int8_threshold, # 6.0
|
57
|
-
)
|
58
|
-
self.param_quantized = vlm_options.quantized # False
|
59
|
-
|
60
|
-
self.processor = AutoProcessor.from_pretrained(artifacts_path)
|
61
|
-
if not self.param_quantized:
|
62
|
-
self.vlm_model = AutoModelForVision2Seq.from_pretrained(
|
63
|
-
artifacts_path,
|
64
|
-
device_map=device,
|
65
|
-
torch_dtype=torch.bfloat16,
|
66
|
-
_attn_implementation=(
|
67
|
-
"flash_attention_2"
|
68
|
-
if self.device.startswith("cuda")
|
69
|
-
and accelerator_options.cuda_use_flash_attention2
|
70
|
-
else "eager"
|
71
|
-
),
|
72
|
-
) # .to(self.device)
|
73
|
-
|
74
|
-
else:
|
75
|
-
self.vlm_model = AutoModelForVision2Seq.from_pretrained(
|
76
|
-
artifacts_path,
|
77
|
-
device_map=device,
|
78
|
-
torch_dtype="auto",
|
79
|
-
quantization_config=self.param_quantization_config,
|
80
|
-
_attn_implementation=(
|
81
|
-
"flash_attention_2"
|
82
|
-
if self.device.startswith("cuda")
|
83
|
-
and accelerator_options.cuda_use_flash_attention2
|
84
|
-
else "eager"
|
85
|
-
),
|
86
|
-
) # .to(self.device)
|
87
|
-
|
88
|
-
@staticmethod
|
89
|
-
def download_models(
|
90
|
-
repo_id: str,
|
91
|
-
local_dir: Optional[Path] = None,
|
92
|
-
force: bool = False,
|
93
|
-
progress: bool = False,
|
94
|
-
) -> Path:
|
95
|
-
from huggingface_hub import snapshot_download
|
96
|
-
from huggingface_hub.utils import disable_progress_bars
|
97
|
-
|
98
|
-
if not progress:
|
99
|
-
disable_progress_bars()
|
100
|
-
download_path = snapshot_download(
|
101
|
-
repo_id=repo_id,
|
102
|
-
force_download=force,
|
103
|
-
local_dir=local_dir,
|
104
|
-
# revision="v0.0.1",
|
105
|
-
)
|
106
|
-
|
107
|
-
return Path(download_path)
|
108
|
-
|
109
|
-
def __call__(
|
110
|
-
self, conv_res: ConversionResult, page_batch: Iterable[Page]
|
111
|
-
) -> Iterable[Page]:
|
112
|
-
for page in page_batch:
|
113
|
-
assert page._backend is not None
|
114
|
-
if not page._backend.is_valid():
|
115
|
-
yield page
|
116
|
-
else:
|
117
|
-
with TimeRecorder(conv_res, "vlm"):
|
118
|
-
assert page.size is not None
|
119
|
-
|
120
|
-
hi_res_image = page.get_image(scale=2.0) # 144dpi
|
121
|
-
# hi_res_image = page.get_image(scale=1.0) # 72dpi
|
122
|
-
|
123
|
-
if hi_res_image is not None:
|
124
|
-
im_width, im_height = hi_res_image.size
|
125
|
-
|
126
|
-
# populate page_tags with predicted doc tags
|
127
|
-
page_tags = ""
|
128
|
-
|
129
|
-
if hi_res_image:
|
130
|
-
if hi_res_image.mode != "RGB":
|
131
|
-
hi_res_image = hi_res_image.convert("RGB")
|
132
|
-
|
133
|
-
messages = [
|
134
|
-
{
|
135
|
-
"role": "user",
|
136
|
-
"content": [
|
137
|
-
{
|
138
|
-
"type": "text",
|
139
|
-
"text": "This is a page from a document.",
|
140
|
-
},
|
141
|
-
{"type": "image"},
|
142
|
-
{"type": "text", "text": self.param_question},
|
143
|
-
],
|
144
|
-
}
|
145
|
-
]
|
146
|
-
prompt = self.processor.apply_chat_template(
|
147
|
-
messages, add_generation_prompt=False
|
148
|
-
)
|
149
|
-
inputs = self.processor(
|
150
|
-
text=prompt, images=[hi_res_image], return_tensors="pt"
|
151
|
-
)
|
152
|
-
inputs = {k: v.to(self.device) for k, v in inputs.items()}
|
153
|
-
|
154
|
-
start_time = time.time()
|
155
|
-
# Call model to generate:
|
156
|
-
generated_ids = self.vlm_model.generate(
|
157
|
-
**inputs, max_new_tokens=4096, use_cache=True
|
158
|
-
)
|
159
|
-
|
160
|
-
generation_time = time.time() - start_time
|
161
|
-
generated_texts = self.processor.batch_decode(
|
162
|
-
generated_ids[:, inputs["input_ids"].shape[1] :],
|
163
|
-
skip_special_tokens=False,
|
164
|
-
)[0]
|
165
|
-
|
166
|
-
num_tokens = len(generated_ids[0])
|
167
|
-
page_tags = generated_texts
|
168
|
-
|
169
|
-
_log.debug(
|
170
|
-
f"Generated {num_tokens} tokens in time {generation_time:.2f} seconds."
|
171
|
-
)
|
172
|
-
|
173
|
-
# inference_time = time.time() - start_time
|
174
|
-
# tokens_per_second = num_tokens / generation_time
|
175
|
-
# print("")
|
176
|
-
# print(f"Page Inference Time: {inference_time:.2f} seconds")
|
177
|
-
# print(f"Total tokens on page: {num_tokens:.2f}")
|
178
|
-
# print(f"Tokens/sec: {tokens_per_second:.2f}")
|
179
|
-
# print("")
|
180
|
-
page.predictions.vlm_response = VlmPrediction(text=page_tags)
|
181
|
-
|
182
|
-
yield page
|
File without changes
|