Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## 0.7.4-dev0
## 0.7.4-dev1

* Fixed bug when PDFMiner predicts that an image text occupies the full page and removes annotations by Chipper.
* Added random seed to Chipper text generation to avoid differences between calls to Chipper.
* Allows user to use super-gradients model if they have a callback predict function, a yaml file with names field corresponding to classes and a path to the model weights

## 0.7.3
Expand Down
2 changes: 1 addition & 1 deletion unstructured_inference/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.4-dev0" # pragma: no cover
__version__ = "0.7.4-dev1" # pragma: no cover
3 changes: 3 additions & 0 deletions unstructured_inference/inference/layoutelement.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def merge_inferred_layout_with_extracted_layout(
continue
region_matched = False
for inferred_region in inferred_layout:
if inferred_region.source in (Source.CHIPPER, Source.CHIPPERV1):
continue

if inferred_region.bbox.intersects(extracted_region.bbox):
same_bbox = region_bounding_boxes_are_almost_the_same(
inferred_region.bbox,
Expand Down
2 changes: 2 additions & 0 deletions unstructured_inference/models/chipper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import cv2
import numpy as np
import torch
import transformers
from huggingface_hub import hf_hub_download
from PIL.Image import Image
from transformers import DonutProcessor, VisionEncoderDecoderModel
Expand Down Expand Up @@ -134,6 +135,7 @@ def predict_tokens(
image: Image,
) -> Tuple[List[int], Sequence[Sequence[torch.Tensor]]]:
"""Predict tokens from image."""
transformers.set_seed(42)
with torch.no_grad():
outputs = self.model.generate(
self.processor(
Expand Down