Skip to content

Commit 0aa5f44

Browse files
ajjimenobadGarnet
andauthored
Adding preprocessor parameters (#427)
Prevent it from giving an exception with newer models. https://huggingface.co/microsoft/table-transformer-structure-recognition-v1.1-all/discussions/1 --------- Co-authored-by: Yao You <[email protected]>
1 parent dac7793 commit 0aa5f44

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.2
2+
3+
* adding parameter to table image preprocessor related to the image size
4+
15
## 1.0.1
26

37
* fix: moving the table transformer model to device when loading the model instead of once the model is loaded.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.0.1" # pragma: no cover
1+
__version__ = "1.0.2" # pragma: no cover

unstructured_inference/models/tables.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ def initialize(
6262
"""Loads the donut model using the specified parameters"""
6363
self.device = device
6464
self.feature_extractor = DetrImageProcessor.from_pretrained(model)
65+
# value not set in the configuration and needed for newer models
66+
# https://huggingface.co/microsoft/table-transformer-structure-recognition-v1.1-all/discussions/1
67+
self.feature_extractor.size["shortest_edge"] = 800
6568

6669
try:
6770
logger.info("Loading the table structure model ...")

0 commit comments

Comments
 (0)