docling-ibm-models 2.0.6__tar.gz → 2.0.8__tar.gz
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-2.0.6 → docling_ibm_models-2.0.8}/PKG-INFO +3 -3
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/data_management/matching_post_processor.py +4 -4
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/data_management/tf_cell_matcher.py +1 -1
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/data_management/tf_predictor.py +7 -5
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/otsl.py +40 -30
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/pyproject.toml +11 -5
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/LICENSE +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/README.md +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/layoutmodel/layout_predictor.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/__init__.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/common.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/data_management/__init__.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/data_management/functional.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/data_management/transforms.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/models/__init__.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/models/common/__init__.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/models/common/base_model.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/models/table04_rs/__init__.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/models/table04_rs/bbox_decoder_rs.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/models/table04_rs/encoder04_rs.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/models/table04_rs/tablemodel04_rs.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/models/table04_rs/transformer_rs.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/settings.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/utils/__init__.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/utils/app_profiler.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/utils/mem_monitor.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/utils/torch_utils.py +0 -0
- {docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/utils/utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: docling-ibm-models
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.8
|
4
4
|
Summary: This package contains the AI models used by the Docling PDF conversion package
|
5
5
|
License: MIT
|
6
6
|
Keywords: docling,convert,document,pdf,layout model,segmentation,table structure,table former
|
@@ -18,12 +18,12 @@ Classifier: Programming Language :: Python :: 3.9
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.10
|
19
19
|
Classifier: Programming Language :: Python :: 3.11
|
20
20
|
Classifier: Programming Language :: Python :: 3.12
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
21
22
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
22
23
|
Requires-Dist: Pillow (>=10.0.0,<11.0.0)
|
23
24
|
Requires-Dist: huggingface_hub (>=0.23,<1)
|
24
25
|
Requires-Dist: jsonlines (>=3.1.0,<4.0.0)
|
25
|
-
Requires-Dist: numpy (>=1.24.4,<
|
26
|
-
Requires-Dist: numpy (>=2.1.0,<3.0.0) ; python_version >= "3.13"
|
26
|
+
Requires-Dist: numpy (>=1.24.4,<3.0.0)
|
27
27
|
Requires-Dist: opencv-python-headless (>=4.6.0.66,<5.0.0.0)
|
28
28
|
Requires-Dist: torch (>=2.2.2,<3.0.0)
|
29
29
|
Requires-Dist: torchvision (>=0,<1)
|
@@ -96,10 +96,10 @@ class MatchingPostProcessor:
|
|
96
96
|
if cell["cell_class"] <= 1:
|
97
97
|
allow_class = False
|
98
98
|
else:
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
99
|
+
self._log().debug("***")
|
100
|
+
self._log().debug("no cell_class in...")
|
101
|
+
self._log().debug(cell)
|
102
|
+
self._log().debug("***")
|
103
103
|
if allow_class:
|
104
104
|
match_list = matches[pdf_cell_id]
|
105
105
|
for match in match_list:
|
@@ -264,7 +264,7 @@ class CellMatcher:
|
|
264
264
|
r, o = otsl.html_to_otsl(table_html_structure, None, False, False, True, False)
|
265
265
|
if not r:
|
266
266
|
ermsg = "ERR#: COULD NOT CONVERT TO RS THIS TABLE TO COMPUTE SPANS"
|
267
|
-
|
267
|
+
self._log().debug(ermsg)
|
268
268
|
else:
|
269
269
|
otsl_spans = o["otsl_spans"]
|
270
270
|
|
@@ -30,6 +30,8 @@ from docling_ibm_models.tableformer.utils.app_profiler import AggProfiler
|
|
30
30
|
# LOG_LEVEL = logging.DEBUG
|
31
31
|
LOG_LEVEL = logging.WARN
|
32
32
|
|
33
|
+
logger = s.get_custom_logger(__name__, LOG_LEVEL)
|
34
|
+
|
33
35
|
|
34
36
|
class bcolors:
|
35
37
|
HEADER = "\033[95m"
|
@@ -53,17 +55,17 @@ def otsl_sqr_chk(rs_list, logdebug):
|
|
53
55
|
|
54
56
|
totcelnum = rs_list.count("fcel") + rs_list.count("ecel")
|
55
57
|
if logdebug:
|
56
|
-
|
58
|
+
logger.debug("Total number of cells = {}".format(totcelnum))
|
57
59
|
|
58
60
|
for ind, ln in enumerate(rs_list_split):
|
59
61
|
ln.append("nl")
|
60
62
|
if logdebug:
|
61
|
-
|
63
|
+
logger.debug("{}".format(ln))
|
62
64
|
if len(ln) != init_tag_len:
|
63
65
|
isSquare = False
|
64
66
|
if isSquare:
|
65
67
|
if logdebug:
|
66
|
-
|
68
|
+
logger.debug(
|
67
69
|
"{}*OK* Table is square! *OK*{}".format(
|
68
70
|
bcolors.OKGREEN, bcolors.ENDC
|
69
71
|
)
|
@@ -71,8 +73,8 @@ def otsl_sqr_chk(rs_list, logdebug):
|
|
71
73
|
else:
|
72
74
|
if logdebug:
|
73
75
|
err_name = "{}***** ERR ******{}"
|
74
|
-
|
75
|
-
|
76
|
+
logger.debug(err_name.format(bcolors.FAIL, bcolors.ENDC))
|
77
|
+
logger.debug(
|
76
78
|
"{}*ERR* Table is not square! *ERR*{}".format(
|
77
79
|
bcolors.FAIL, bcolors.ENDC
|
78
80
|
)
|
{docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/otsl.py
RENAMED
@@ -49,15 +49,15 @@ def otsl_sqr_chk(rs_list, name, logdebug):
|
|
49
49
|
isSquare = False
|
50
50
|
if isSquare:
|
51
51
|
if logdebug:
|
52
|
-
|
52
|
+
logger.debug(
|
53
53
|
"{}*OK* Table is square! *OK*{}".format(
|
54
54
|
bcolors.OKGREEN, bcolors.ENDC
|
55
55
|
)
|
56
56
|
)
|
57
57
|
else:
|
58
58
|
err_name = "{}*ERR* " + name + " *ERR*{}"
|
59
|
-
|
60
|
-
|
59
|
+
logger.debug(err_name.format(bcolors.FAIL, bcolors.ENDC))
|
60
|
+
logger.debug(
|
61
61
|
"{}*ERR* Table is not square! *ERR*{}".format(
|
62
62
|
bcolors.FAIL, bcolors.ENDC
|
63
63
|
)
|
@@ -89,9 +89,9 @@ def otsl_tags_cells_sync_chk(rs_list, cells, name, logdebug):
|
|
89
89
|
countCellTags += 1
|
90
90
|
if countCellTags != len(cells):
|
91
91
|
err_name = "{}*!ERR* " + name + " *ERR!*{}"
|
92
|
-
|
92
|
+
logger.debug(err_name.format(bcolors.FAIL, bcolors.ENDC))
|
93
93
|
err_msg = "{}*!ERR* Tags are not in sync with cells! *ERR!*{}"
|
94
|
-
|
94
|
+
logger.debug(err_msg.format(bcolors.FAIL, bcolors.ENDC))
|
95
95
|
isGood = False
|
96
96
|
return isGood
|
97
97
|
|
@@ -131,11 +131,13 @@ def otsl_to_html(rs_list, logdebug):
|
|
131
131
|
return rs_list
|
132
132
|
html_table = []
|
133
133
|
if logdebug:
|
134
|
-
|
134
|
+
logger.debug(
|
135
|
+
"{}*Reconstructing HTML...*{}".format(bcolors.WARNING, bcolors.ENDC)
|
136
|
+
)
|
135
137
|
|
136
138
|
if not otsl_sqr_chk(rs_list, "---", logdebug):
|
137
139
|
# PAD TABLE TO SQUARE
|
138
|
-
|
140
|
+
logger.debug("{}*Padding to square...*{}".format(bcolors.WARNING, bcolors.ENDC))
|
139
141
|
rs_list = otsl_pad_to_sqr(rs_list, "lcel")
|
140
142
|
|
141
143
|
# 2D structure, line by line:
|
@@ -144,7 +146,7 @@ def otsl_to_html(rs_list, logdebug):
|
|
144
146
|
]
|
145
147
|
|
146
148
|
if logdebug:
|
147
|
-
|
149
|
+
logger.debug("")
|
148
150
|
|
149
151
|
# Sequentially store indexes of 2D spans that were registered to avoid re-registering them
|
150
152
|
registry_2d_span = []
|
@@ -182,9 +184,9 @@ def otsl_to_html(rs_list, logdebug):
|
|
182
184
|
span = True
|
183
185
|
# Check if it has vertical span:
|
184
186
|
if rs_row_ind + 1 < len(rs_list_split):
|
185
|
-
#
|
186
|
-
#
|
187
|
-
#
|
187
|
+
# logger.debug(">>>")
|
188
|
+
# logger.debug(rs_list_split[rs_row_ind + 1])
|
189
|
+
# logger.debug(">>> rs_cell_ind = {}".format(rs_cell_ind))
|
188
190
|
if rs_list_split[rs_row_ind + 1][rs_cell_ind] == "ucel":
|
189
191
|
ddist = otsl_check_down(rs_list_split, rs_cell_ind, rs_row_ind)
|
190
192
|
span = True
|
@@ -198,12 +200,12 @@ def otsl_to_html(rs_list, logdebug):
|
|
198
200
|
span = True
|
199
201
|
# Check if this 2D span was already registered,
|
200
202
|
# If not - register, if yes - cancel span
|
201
|
-
#
|
202
|
-
#
|
203
|
+
# logger.debug("rs_cell_ind: {}, xrdist:{}".format(rs_cell_ind, xrdist))
|
204
|
+
# logger.debug("rs_row_ind: {}, xddist:{}".format(rs_cell_ind, xrdist))
|
203
205
|
for x in range(rs_cell_ind, xrdist + rs_cell_ind):
|
204
206
|
for y in range(rs_row_ind, xddist + rs_row_ind):
|
205
207
|
reg2dind = str(x) + "_" + str(y)
|
206
|
-
#
|
208
|
+
# logger.debug(reg2dind)
|
207
209
|
if reg2dind in registry_2d_span:
|
208
210
|
# Cell of the span is already in, cancel current span
|
209
211
|
span = False
|
@@ -232,9 +234,13 @@ def otsl_to_html(rs_list, logdebug):
|
|
232
234
|
html_table.extend(html_list)
|
233
235
|
|
234
236
|
if logdebug:
|
235
|
-
|
236
|
-
|
237
|
-
|
237
|
+
logger.debug(
|
238
|
+
"*********************** registry_2d_span ***************************"
|
239
|
+
)
|
240
|
+
logger.debug(registry_2d_span)
|
241
|
+
logger.debug(
|
242
|
+
"********************************************************************"
|
243
|
+
)
|
238
244
|
|
239
245
|
return html_table
|
240
246
|
|
@@ -316,20 +322,24 @@ def html_to_otsl(table, writer, logdebug, extra_debug, include_html, use_writer)
|
|
316
322
|
current_line_expands = []
|
317
323
|
|
318
324
|
if logdebug:
|
319
|
-
|
320
|
-
|
325
|
+
logger.debug("")
|
326
|
+
logger.debug("*** {}: {} ***".format(table["split"], table["filename"]))
|
321
327
|
|
322
328
|
colnum = 0
|
323
329
|
|
324
330
|
if extra_debug:
|
325
|
-
|
326
|
-
|
327
|
-
|
331
|
+
logger.debug(
|
332
|
+
"========================== Input HTML ============================"
|
333
|
+
)
|
334
|
+
logger.debug(table_html_structure["tokens"])
|
335
|
+
logger.debug(
|
336
|
+
"=================================================================="
|
337
|
+
)
|
328
338
|
|
329
339
|
if logdebug:
|
330
|
-
|
331
|
-
|
332
|
-
|
340
|
+
logger.debug("********")
|
341
|
+
logger.debug("* OTSL *")
|
342
|
+
logger.debug("********")
|
333
343
|
|
334
344
|
for i in range(len(table_html_structure["tokens"])):
|
335
345
|
html_tag = table_html_structure["tokens"][i]
|
@@ -377,7 +387,7 @@ def html_to_otsl(table, writer, logdebug, extra_debug, include_html, use_writer)
|
|
377
387
|
extra_columns = pre_line_len - cur_line_len - 1
|
378
388
|
if extra_columns > 0:
|
379
389
|
if extra_debug:
|
380
|
-
|
390
|
+
logger.debug(
|
381
391
|
"Extra columns needed in row: {}".format(
|
382
392
|
extra_columns
|
383
393
|
)
|
@@ -534,11 +544,11 @@ def html_to_otsl(table, writer, logdebug, extra_debug, include_html, use_writer)
|
|
534
544
|
writer.write(out_line)
|
535
545
|
|
536
546
|
if logdebug:
|
537
|
-
|
538
|
-
|
547
|
+
logger.debug("{}Reconstructed HTML:{}".format(bcolors.OKGREEN, bcolors.ENDC))
|
548
|
+
logger.debug(rHTML)
|
539
549
|
# original HTML
|
540
550
|
oHTML = out_line["html"]["html_structure"]
|
541
|
-
|
542
|
-
|
551
|
+
logger.debug("{}Original HTML:{}".format(bcolors.OKBLUE, bcolors.ENDC))
|
552
|
+
logger.debug(oHTML)
|
543
553
|
|
544
554
|
return True, out_line
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "docling-ibm-models"
|
3
|
-
version = "2.0.
|
3
|
+
version = "2.0.8" # DO NOT EDIT, updated automatically
|
4
4
|
description = "This package contains the AI models used by the Docling PDF conversion package"
|
5
5
|
authors = ["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
6
|
license = "MIT"
|
@@ -24,10 +24,7 @@ packages = [
|
|
24
24
|
python = "^3.9"
|
25
25
|
torch = "^2.2.2"
|
26
26
|
torchvision = "^0"
|
27
|
-
numpy =
|
28
|
-
{ version = "^2.1.0", markers = 'python_version >= "3.13"' },
|
29
|
-
{ version = "^1.24.4", markers = 'python_version < "3.13"' },
|
30
|
-
]
|
27
|
+
numpy = ">=1.24.4,<3.0.0"
|
31
28
|
jsonlines = "^3.1.0"
|
32
29
|
Pillow = "^10.0.0"
|
33
30
|
tqdm = "^4.64.0"
|
@@ -63,6 +60,15 @@ torchvision = [
|
|
63
60
|
{markers = "sys_platform == 'darwin' and platform_machine == 'x86_64'", version = "~0.17.2"}
|
64
61
|
]
|
65
62
|
|
63
|
+
[tool.poetry.group.constraints]
|
64
|
+
optional = true
|
65
|
+
|
66
|
+
[tool.poetry.group.constraints.dependencies]
|
67
|
+
numpy = [
|
68
|
+
{ version = ">=1.24.4,<3.0.0", markers = 'python_version >= "3.10"' },
|
69
|
+
{ version = ">=1.24.4,<2.1.0", markers = 'python_version < "3.10"' },
|
70
|
+
]
|
71
|
+
|
66
72
|
|
67
73
|
[build-system]
|
68
74
|
requires = ["poetry-core>=1.0.0"]
|
File without changes
|
File without changes
|
File without changes
|
{docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/__init__.py
RENAMED
File without changes
|
{docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/common.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/settings.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{docling_ibm_models-2.0.6 → docling_ibm_models-2.0.8}/docling_ibm_models/tableformer/utils/utils.py
RENAMED
File without changes
|