docling-ibm-models 3.4.2__py3-none-any.whl → 3.4.4__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_ibm_models/code_formula_model/models/sam_opt.py +8 -8
- {docling_ibm_models-3.4.2.dist-info → docling_ibm_models-3.4.4.dist-info}/METADATA +27 -78
- {docling_ibm_models-3.4.2.dist-info → docling_ibm_models-3.4.4.dist-info}/RECORD +9 -8
- {docling_ibm_models-3.4.2.dist-info → docling_ibm_models-3.4.4.dist-info}/WHEEL +2 -1
- docling_ibm_models-3.4.4.dist-info/top_level.txt +1 -0
- {docling_ibm_models-3.4.2.dist-info → docling_ibm_models-3.4.4.dist-info/licenses}/LICENSE +0 -0
@@ -52,7 +52,7 @@ class SamOptConfig(OPTConfig):
|
|
52
52
|
|
53
53
|
|
54
54
|
class SamOPTModel(OPTModel):
|
55
|
-
config_class = SamOptConfig
|
55
|
+
config_class = SamOptConfig # type: ignore
|
56
56
|
|
57
57
|
def __init__(self, config: OPTConfig):
|
58
58
|
super(SamOPTModel, self).__init__(config)
|
@@ -82,10 +82,10 @@ class SamOPTModel(OPTModel):
|
|
82
82
|
inputs_embeds = self.embed_tokens(input_ids)
|
83
83
|
|
84
84
|
vision_tower = getattr(self, "vision_tower", None)
|
85
|
-
im_start_token = getattr(self.config, "im_start_token", -1)
|
85
|
+
im_start_token = getattr(self.config, "im_start_token", -1) # type: ignore
|
86
86
|
|
87
|
-
if input_ids.shape[1] != 1 or self.training:
|
88
|
-
with torch.set_grad_enabled(self.training):
|
87
|
+
if input_ids.shape[1] != 1 or self.training: # type: ignore
|
88
|
+
with torch.set_grad_enabled(self.training): # type: ignore
|
89
89
|
assert vision_tower is not None
|
90
90
|
image_features = vision_tower(images)
|
91
91
|
image_features = image_features.flatten(2).permute(0, 2, 1)
|
@@ -118,7 +118,7 @@ class SamOPTModel(OPTModel):
|
|
118
118
|
|
119
119
|
inputs_embeds = torch.stack(new_input_embeds, dim=0) # type: ignore
|
120
120
|
|
121
|
-
return super(SamOPTModel, self).forward(
|
121
|
+
return super(SamOPTModel, self).forward( # type: ignore
|
122
122
|
input_ids=None,
|
123
123
|
attention_mask=attention_mask,
|
124
124
|
past_key_values=past_key_values,
|
@@ -131,7 +131,7 @@ class SamOPTModel(OPTModel):
|
|
131
131
|
|
132
132
|
|
133
133
|
class SamOPTForCausalLM(OPTForCausalLM):
|
134
|
-
config_class = SamOptConfig
|
134
|
+
config_class = SamOptConfig # type: ignore
|
135
135
|
|
136
136
|
def __init__(self, config):
|
137
137
|
super(OPTForCausalLM, self).__init__(config)
|
@@ -165,12 +165,12 @@ class SamOPTForCausalLM(OPTForCausalLM):
|
|
165
165
|
output_attentions = (
|
166
166
|
output_attentions
|
167
167
|
if output_attentions is not None
|
168
|
-
else self.config.output_attentions
|
168
|
+
else self.config.output_attentions # type: ignore
|
169
169
|
)
|
170
170
|
output_hidden_states = (
|
171
171
|
output_hidden_states
|
172
172
|
if output_hidden_states is not None
|
173
|
-
else self.config.output_hidden_states
|
173
|
+
else self.config.output_hidden_states # type: ignore
|
174
174
|
)
|
175
175
|
|
176
176
|
outputs = self.model(
|
@@ -1,44 +1,41 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: docling-ibm-models
|
3
|
-
Version: 3.4.
|
3
|
+
Version: 3.4.4
|
4
4
|
Summary: This package contains the AI models used by the Docling PDF conversion package
|
5
|
-
|
5
|
+
Author-email: Nikos Livathinos <nli@zurich.ibm.com>, Maxim Lysak <mly@zurich.ibm.com>, Ahmed Nassar <ahn@zurich.ibm.com>, Christoph Auer <cau@zurich.ibm.com>, Michele Dolfi <dol@zurich.ibm.com>, Peter Staar <taa@zurich.ibm.com>
|
6
|
+
License-Expression: MIT
|
7
|
+
Project-URL: homepage, https://github.com/docling-project/docling-ibm-models
|
8
|
+
Project-URL: repository, https://github.com/docling-project/docling-ibm-models
|
9
|
+
Project-URL: issues, https://github.com/docling-project/docling-ibm-models/issues
|
10
|
+
Project-URL: changelog, https://github.com/docling-project/docling-ibm-models/blob/main/CHANGELOG.md
|
6
11
|
Keywords: docling,convert,document,pdf,layout model,segmentation,table structure,table former
|
7
|
-
|
8
|
-
|
9
|
-
Requires-Python: >=3.9,<4.0
|
12
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
13
|
+
Classifier: Operating System :: POSIX :: Linux
|
10
14
|
Classifier: Development Status :: 5 - Production/Stable
|
11
15
|
Classifier: Intended Audience :: Developers
|
12
16
|
Classifier: Intended Audience :: Science/Research
|
13
|
-
Classifier: License :: OSI Approved :: MIT License
|
14
|
-
Classifier: Operating System :: MacOS :: MacOS X
|
15
|
-
Classifier: Operating System :: POSIX :: Linux
|
16
|
-
Classifier: Programming Language :: Python :: 3
|
17
|
-
Classifier: Programming Language :: Python :: 3.9
|
18
|
-
Classifier: Programming Language :: Python :: 3.10
|
19
|
-
Classifier: Programming Language :: Python :: 3.11
|
20
|
-
Classifier: Programming Language :: Python :: 3.12
|
21
|
-
Classifier: Programming Language :: Python :: 3.13
|
22
17
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
23
|
-
|
24
|
-
Requires-
|
25
|
-
Requires-Dist: huggingface_hub (>=0.23,<1)
|
26
|
-
Requires-Dist: jsonlines (>=3.1.0,<4.0.0)
|
27
|
-
Requires-Dist: numpy (>=1.24.4,<2.0.0) ; sys_platform == "darwin" and platform_machine == "x86_64"
|
28
|
-
Requires-Dist: numpy (>=1.24.4,<3.0.0) ; sys_platform != "darwin" or platform_machine != "x86_64"
|
29
|
-
Requires-Dist: opencv-python-headless (>=4.6.0.66,<5.0.0.0)
|
30
|
-
Requires-Dist: pydantic (>=2.0.0,<3.0.0)
|
31
|
-
Requires-Dist: safetensors[torch] (>=0.4.3,<1)
|
32
|
-
Requires-Dist: torch (>=2.2.2,<3.0.0)
|
33
|
-
Requires-Dist: torchvision (>=0,<1)
|
34
|
-
Requires-Dist: tqdm (>=4.64.0,<5.0.0)
|
35
|
-
Requires-Dist: transformers (>=4.42.0,<4.43.0) ; sys_platform == "darwin" and platform_machine == "x86_64"
|
36
|
-
Requires-Dist: transformers (>=4.42.0,<5.0.0) ; sys_platform != "darwin" or platform_machine != "x86_64"
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
19
|
+
Requires-Python: <4.0,>=3.9
|
37
20
|
Description-Content-Type: text/markdown
|
21
|
+
License-File: LICENSE
|
22
|
+
Requires-Dist: torch<3.0.0,>=2.2.2
|
23
|
+
Requires-Dist: torchvision<1,>=0
|
24
|
+
Requires-Dist: jsonlines<4.0.0,>=3.1.0
|
25
|
+
Requires-Dist: Pillow<12.0.0,>=10.0.0
|
26
|
+
Requires-Dist: tqdm<5.0.0,>=4.64.0
|
27
|
+
Requires-Dist: opencv-python-headless<5.0.0.0,>=4.6.0.66
|
28
|
+
Requires-Dist: huggingface_hub<1,>=0.23
|
29
|
+
Requires-Dist: safetensors[torch]<1,>=0.4.3
|
30
|
+
Requires-Dist: pydantic<3.0.0,>=2.0.0
|
31
|
+
Requires-Dist: docling-core<3.0.0,>=2.19.0
|
32
|
+
Requires-Dist: transformers<5.0.0,>=4.42.0
|
33
|
+
Requires-Dist: numpy<3.0.0,>=1.24.4
|
34
|
+
Dynamic: license-file
|
38
35
|
|
39
36
|
[](https://pypi.org/project/docling-ibm-models/)
|
40
37
|
[](https://pypi.org/project/docling-ibm-models/)
|
41
|
-
[](https://github.com/astral-sh/uv)
|
42
39
|
[](https://github.com/psf/black)
|
43
40
|
[](https://pycqa.github.io/isort/)
|
44
41
|
[](https://github.com/pre-commit/pre-commit)
|
@@ -53,53 +50,6 @@ AI modules to support the Docling PDF document conversion project.
|
|
53
50
|
- Layout model is an AI model that provides among other things ability to detect tables on the page. This package contains inference code for Layout model.
|
54
51
|
|
55
52
|
|
56
|
-
## Installation Instructions
|
57
|
-
|
58
|
-
### MacOS / Linux
|
59
|
-
|
60
|
-
To install `poetry` locally, use either `pip` or `homebrew`.
|
61
|
-
|
62
|
-
To install `poetry` on a docker container, do the following:
|
63
|
-
```
|
64
|
-
ENV POETRY_NO_INTERACTION=1 \
|
65
|
-
POETRY_VIRTUALENVS_CREATE=false
|
66
|
-
|
67
|
-
# Install poetry
|
68
|
-
RUN curl -sSL 'https://install.python-poetry.org' > install-poetry.py \
|
69
|
-
&& python install-poetry.py \
|
70
|
-
&& poetry --version \
|
71
|
-
&& rm install-poetry.py
|
72
|
-
```
|
73
|
-
|
74
|
-
To install and run the package, simply set up a poetry environment
|
75
|
-
|
76
|
-
```
|
77
|
-
poetry env use $(which python3.10)
|
78
|
-
poetry shell
|
79
|
-
```
|
80
|
-
|
81
|
-
and install all the dependencies,
|
82
|
-
|
83
|
-
```
|
84
|
-
poetry install # this will only install the deps from the poetry.lock
|
85
|
-
|
86
|
-
poetry install --no-dev # this will skip installing dev dependencies
|
87
|
-
```
|
88
|
-
|
89
|
-
To update or add new dependencies from `pyproject.toml`, rebuild `poetry.lock`
|
90
|
-
```
|
91
|
-
poetry update
|
92
|
-
```
|
93
|
-
|
94
|
-
#### MacOS Intel
|
95
|
-
|
96
|
-
When in development mode on MacOS with Intel chips, one can use compatible dependencies with
|
97
|
-
|
98
|
-
```console
|
99
|
-
poetry update --with mac_intel
|
100
|
-
```
|
101
|
-
|
102
|
-
|
103
53
|
## Pipeline Overview
|
104
54
|

|
105
55
|
|
@@ -177,4 +127,3 @@ e.g.
|
|
177
127
|
```
|
178
128
|
python -m demo.demo_layout_predictor -i tests/test_data/samples -v viz/
|
179
129
|
```
|
180
|
-
|
@@ -1,19 +1,21 @@
|
|
1
1
|
docling_ibm_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
docling_ibm_models/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
3
|
docling_ibm_models/code_formula_model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
4
|
docling_ibm_models/code_formula_model/code_formula_predictor.py,sha256=yX0Cd1o-dkJtju5WKtSk7L2b0jc6P_KgxrsZN5_SBb0,9445
|
4
5
|
docling_ibm_models/code_formula_model/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
6
|
docling_ibm_models/code_formula_model/models/sam.py,sha256=6MXf1ae_wRWJ4b1luISWXBRKyoQie7YbpY-qwq1OJJA,17841
|
6
|
-
docling_ibm_models/code_formula_model/models/sam_opt.py,sha256=
|
7
|
+
docling_ibm_models/code_formula_model/models/sam_opt.py,sha256=EHS4LXLFNbOOtQgypQ01TY9zXtQIzFjVLnJaAGddJzg,8557
|
7
8
|
docling_ibm_models/code_formula_model/models/sam_opt_image_processor.py,sha256=6uAU4KSr4pVTesQZHgvbZxSjvJZ3JfRSdetuoos3DeE,921
|
8
9
|
docling_ibm_models/document_figure_classifier_model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
10
|
docling_ibm_models/document_figure_classifier_model/document_figure_classifier_predictor.py,sha256=vRIp02rs9Xa4n1K-M7AYO_tFj4S7WQCQmL9i006T9Qk,5795
|
10
11
|
docling_ibm_models/layoutmodel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
12
|
docling_ibm_models/layoutmodel/layout_predictor.py,sha256=ArVgs7FBOiu23TC-JoybcaTp7F7a4BgYC8uRVxTgx4E,5681
|
12
|
-
docling_ibm_models/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
docling_ibm_models/reading_order/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
14
|
docling_ibm_models/reading_order/reading_order_rb.py,sha256=Vk3ufc47w2FnVaLI5UGpxoBTZFcpWuIrSAaNGa9c5Rg,20416
|
15
15
|
docling_ibm_models/tableformer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
16
|
docling_ibm_models/tableformer/common.py,sha256=2zgGZBFf4fXytEaXrZR2NU6FWdX2kxO0DHlGZmuvpNQ,3230
|
17
|
+
docling_ibm_models/tableformer/otsl.py,sha256=DxEwJVC_IqomZs_wUzj-TWjUUgQuEVcm8MXru7VYGkA,21391
|
18
|
+
docling_ibm_models/tableformer/settings.py,sha256=UlpsP0cpJZR2Uk48lgysYy0om3fr8Xt3z1xzvlTw5j4,3067
|
17
19
|
docling_ibm_models/tableformer/data_management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
20
|
docling_ibm_models/tableformer/data_management/functional.py,sha256=kJntHEXFz2SP7obEcHyjAqZNZC9qh-U75MwUJALLADI,3143
|
19
21
|
docling_ibm_models/tableformer/data_management/matching_post_processor.py,sha256=_MVbsm0l5aKP3ChvKhXFeZ2Gz_DHGLlyMbqbKTan_MU,56721
|
@@ -28,13 +30,12 @@ docling_ibm_models/tableformer/models/table04_rs/bbox_decoder_rs.py,sha256=JV9rF
|
|
28
30
|
docling_ibm_models/tableformer/models/table04_rs/encoder04_rs.py,sha256=iExmqJ0Pn0lJU3nWb_x8abTn42GctMqE55_YA2ppgvc,1975
|
29
31
|
docling_ibm_models/tableformer/models/table04_rs/tablemodel04_rs.py,sha256=Mv17JGgO12hIt8jrnflWLgOimdFYkBLuV0rxaGawBpk,12266
|
30
32
|
docling_ibm_models/tableformer/models/table04_rs/transformer_rs.py,sha256=2i5qqVijyic2VeMI0d1-9gVg2vTbxfi9Ciyo-r41iOY,6464
|
31
|
-
docling_ibm_models/tableformer/otsl.py,sha256=DxEwJVC_IqomZs_wUzj-TWjUUgQuEVcm8MXru7VYGkA,21391
|
32
|
-
docling_ibm_models/tableformer/settings.py,sha256=UlpsP0cpJZR2Uk48lgysYy0om3fr8Xt3z1xzvlTw5j4,3067
|
33
33
|
docling_ibm_models/tableformer/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
34
34
|
docling_ibm_models/tableformer/utils/app_profiler.py,sha256=Pb7o1zcikKXh7ninaNt4_nVa1xuUrogZxbTr6U6jkEE,8392
|
35
35
|
docling_ibm_models/tableformer/utils/mem_monitor.py,sha256=NFZUnrfLThXNZQrm3ESRmPSJmPF2J1z3E2v_72O4dRw,6408
|
36
36
|
docling_ibm_models/tableformer/utils/utils.py,sha256=8Bxf1rEn977lFbY9NX0r5xh9PvxIRipQZX_EZW92XfA,10980
|
37
|
-
docling_ibm_models-3.4.
|
38
|
-
docling_ibm_models-3.4.
|
39
|
-
docling_ibm_models-3.4.
|
40
|
-
docling_ibm_models-3.4.
|
37
|
+
docling_ibm_models-3.4.4.dist-info/licenses/LICENSE,sha256=mBb7ErEcM8VS9OhiGHnQ2kk75HwPhr54W1Oiz3965MY,1088
|
38
|
+
docling_ibm_models-3.4.4.dist-info/METADATA,sha256=_gfa7Fz_yuyE1m_t06O04YuroSoSAUxlvVRO3WWTBOg,6370
|
39
|
+
docling_ibm_models-3.4.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
40
|
+
docling_ibm_models-3.4.4.dist-info/top_level.txt,sha256=tIB9D3naeP7s92RAs1d9SPaHc4S4iQIepjtbkf5Q5g0,19
|
41
|
+
docling_ibm_models-3.4.4.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
docling_ibm_models
|
File without changes
|