Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING CHANGE: remove legacy detectron2 model; remove layoutparser extras #350

Merged
merged 11 commits into from
May 22, 2024

Conversation

MthwRobinson
Copy link
Contributor

@MthwRobinson MthwRobinson commented May 22, 2024

Summary

First step in resolving Unstructured-IO/unstructured#3051. Per this comment, we were having troubling running unstructured in the Python 3.12 wolfi-base contain due to issues related to pycocotools, which is only used for the legacy detectron2 model from layoutparser. Since we've replaced this with detectron2onnx, this PR removes the layoutparser extra dependencies that caused issues with Python 3.12.

The layoutparser base dependency is still required because we use layout objects from that library. It's likely we could remove these in a future iteration.

Temporarily disabled the ingest tests, because they seem to have been broken for the past six months. Last commit that they passed for was this one. Opened #352 to reenable them.

Testing

If CI passes we should be good to go.

@MthwRobinson MthwRobinson requested review from qued and scanny May 22, 2024 15:24
@MthwRobinson MthwRobinson changed the title deps: remove layoutparser extras BREAKING CHANGE: remove legacy detectron2 model; remove layoutparser extras May 22, 2024
@MthwRobinson MthwRobinson marked this pull request as ready for review May 22, 2024 15:24
portalocker==2.8.2
# via iopath
protobuf==5.26.1
# via
# onnx
# onnxruntime
pycocotools==2.0.7
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the dependency we needed to remove

@@ -1,10 +1,12 @@
-c constraints.in
layoutparser[layoutmodels,tesseract]
layoutparser
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we not able to lose layoutparser completely?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still have this TextBox element we rely on from layoutparser, but I wonder if we can just copy that over

from layoutparser.elements.layout import TextBlock

Copy link
Contributor Author

@MthwRobinson MthwRobinson May 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That class has dependencies from a couple different modules in layoutparser, doesn't look as simpler as copying over a small class. Opened #351 for follow on work to see if we can get rid of TextBlock.

@MthwRobinson
Copy link
Contributor Author

@qued - Tests are passing now, should be good for final review!

Copy link
Contributor

@qued qued left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@MthwRobinson MthwRobinson merged commit 7b2125b into main May 22, 2024
5 checks passed
@MthwRobinson MthwRobinson deleted the deps/remove-pycocotools branch May 22, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants