docling-ibm-models 1.1.1__py3-none-any.whl → 1.1.2__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.
@@ -99,8 +99,13 @@ class TFPredictor:
99
99
  Table predictions for the in-memory Docling API
100
100
  """
101
101
 
102
- def __init__(self, config):
102
+ def __init__(self, config, num_threads: int = None):
103
103
  r"""
104
+ The number of threads is decided, in the following order, by:
105
+ 1. The init method parameter `num_threads`, if it is set.
106
+ 2. The envvar "OMP_NUM_THREADS", if it is set.
107
+ 3. The default value 4.
108
+
104
109
  Parameters
105
110
  ----------
106
111
  config : dict
@@ -123,6 +128,13 @@ class TFPredictor:
123
128
  self._post_processor = MatchingPostProcessor(config)
124
129
 
125
130
  self._init_word_map()
131
+
132
+ # Set the number of torch threads
133
+ if num_threads is None:
134
+ num_threads = int(os.environ.get("OMP_NUM_THREADS", 4))
135
+ self._num_threads = num_threads
136
+ torch.set_num_threads(num_threads)
137
+
126
138
  # Load the model
127
139
  self._model = self._load_model()
128
140
  self._model.eval()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: docling-ibm-models
3
- Version: 1.1.1
3
+ Version: 1.1.2
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
@@ -26,8 +26,7 @@ Requires-Dist: lxml (>=4.9.1,<5.0.0)
26
26
  Requires-Dist: mean_average_precision (>=2021.4.26.0,<2022.0.0.0)
27
27
  Requires-Dist: numpy (>=1.24.4,<2.0.0)
28
28
  Requires-Dist: onnxruntime (>=1.16.2,<2.0.0)
29
- Requires-Dist: opencv-python (>=4.9.0.80,<5.0.0.0) ; sys_platform != "linux"
30
- Requires-Dist: opencv-python-headless (>=4.9.0.80,<5.0.0.0) ; sys_platform == "linux"
29
+ Requires-Dist: opencv-python-headless (>=4.9.0.80,<5.0.0.0)
31
30
  Requires-Dist: torch (>=2.2.2,<3.0.0)
32
31
  Requires-Dist: torchvision (>=0.17.2)
33
32
  Requires-Dist: tqdm (>=4.64.0,<5.0.0)
@@ -7,7 +7,7 @@ docling_ibm_models/tableformer/data_management/functional.py,sha256=UrXsEm4DSc1Q
7
7
  docling_ibm_models/tableformer/data_management/matching_post_processor.py,sha256=HYG-wx5PQC38hTQfyXr3zUnZ6--aSs55x8g9PdsROGU,54207
8
8
  docling_ibm_models/tableformer/data_management/tf_cell_matcher.py,sha256=DFu428Cr84maT9WehdoZkpkJKeahwe5JlclvTC6fuVY,20870
9
9
  docling_ibm_models/tableformer/data_management/tf_dataset.py,sha256=6_qSsYt6qoE2JBzUNrJfCDX3Kgg7tyrv3kimGLdEQ5o,49890
10
- docling_ibm_models/tableformer/data_management/tf_predictor.py,sha256=3e7ICgs3r9YclOLWuoOvqSveQHcERvZYmOBMtmslJqU,38502
10
+ docling_ibm_models/tableformer/data_management/tf_predictor.py,sha256=LxRme9AWLZhQw7xP5Tpxwa5XFTY66m5IFS5v9VC30GA,38978
11
11
  docling_ibm_models/tableformer/data_management/transforms.py,sha256=_i1HXkX8LAuHbeGRrg8kF9yFNJRQZOKmWzxKt559ABQ,13268
12
12
  docling_ibm_models/tableformer/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  docling_ibm_models/tableformer/models/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -26,7 +26,7 @@ docling_ibm_models/tableformer/utils/app_profiler.py,sha256=13dvwo5byzfP2ejqGBFw
26
26
  docling_ibm_models/tableformer/utils/torch_utils.py,sha256=uN0rK9mSXy1ewBnBnILrWebJhhVU4N-XJZBqNiLJwlQ,8893
27
27
  docling_ibm_models/tableformer/utils/utils.py,sha256=8Bxf1rEn977lFbY9NX0r5xh9PvxIRipQZX_EZW92XfA,10980
28
28
  docling_ibm_models/tableformer/utils/variance.py,sha256=USjRwaMsCmzvc6PeWskaAJnUjbliRVd_MqNKLjMDQw8,4675
29
- docling_ibm_models-1.1.1.dist-info/LICENSE,sha256=ACwmltkrXIz5VsEQcrqljq-fat6ZXAMepjXGoe40KtE,1069
30
- docling_ibm_models-1.1.1.dist-info/METADATA,sha256=u1QQMa4RVoxKF7rW30Aa7WeY-JIll0fWxQtLUZNJbCU,7035
31
- docling_ibm_models-1.1.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
32
- docling_ibm_models-1.1.1.dist-info/RECORD,,
29
+ docling_ibm_models-1.1.2.dist-info/LICENSE,sha256=ACwmltkrXIz5VsEQcrqljq-fat6ZXAMepjXGoe40KtE,1069
30
+ docling_ibm_models-1.1.2.dist-info/METADATA,sha256=jjNK_i4x4icNrs51b-aKOe08OJOJ7OhVXN6x3mmjsQw,6932
31
+ docling_ibm_models-1.1.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
32
+ docling_ibm_models-1.1.2.dist-info/RECORD,,