unstructured-inference 1.6.0


pip install unstructured-inference

  Latest version

Released: Apr 01, 2026

Project Links

Meta
Author: Unstructured Technologies
Requires Python: <3.13,>=3.12

Classifiers

Development Status
  • 4 - Beta

Intended Audience
  • Developers
  • Education
  • Science/Research

License
  • OSI Approved :: Apache Software License

Operating System
  • OS Independent

Programming Language
  • Python :: 3
  • Python :: 3.12

Topic
  • Scientific/Engineering :: Artificial Intelligence

Open-Source Pre-Processing Tools for Unstructured Data

The unstructured-inference repo contains hosted model inference code for layout parsing models. These models are invoked via API as part of the partitioning bricks in the unstructured package.

Requires Python 3.12+.

Installation

Package

pip install unstructured-inference

Detectron2

Detectron2 is required for using models from the layoutparser model zoo but is not automatically installed with this package. For MacOS and Linux, build from source with:

pip install 'git+https://github.com/facebookresearch/detectron2.git@57bdb21249d5418c130d54e2ebdc94dda7a4c01a'

Other install options can be found in the Detectron2 installation guide.

Windows is not officially supported by Detectron2, but some users are able to install it anyway. See discussion here for tips on installing Detectron2 on Windows.

Development Setup

This project uses uv for dependency management.

# Clone and install all dependencies (including dev/test/lint groups)
git clone https://github.com/Unstructured-IO/unstructured-inference.git
cd unstructured-inference
make install

Run make help for a full list of available targets.

Getting Started

To get started with the layout parsing model, use the following commands:

from unstructured_inference.inference.layout import DocumentLayout

layout = DocumentLayout.from_file("sample-docs/loremipsum.pdf")

print(layout.pages[0].elements)

Once the model has detected the layout and OCR'd the document, the text extracted from the first page of the sample document will be displayed. You can convert a given element to a dict by running the .to_dict() method.

Models

The inference pipeline operates by finding text elements in a document page using a detection model, then extracting the contents of the elements using direct extraction (if available), OCR, and optionally table inference models.

We offer several detection models including Detectron2 and YOLOX.

Using a non-default model

When doing inference, an alternate model can be used by passing the model object to the ingestion method via the model parameter. The get_model function can be used to construct one of our out-of-the-box models from a keyword, e.g.:

from unstructured_inference.models.base import get_model
from unstructured_inference.inference.layout import DocumentLayout

model = get_model("yolox")
layout = DocumentLayout.from_file("sample-docs/layout-parser-paper.pdf", detection_model=model)

Using your own model

Any detection model can be used for in the unstructured_inference pipeline by wrapping the model in the UnstructuredObjectDetectionModel class. To integrate with the DocumentLayout class, a subclass of UnstructuredObjectDetectionModel must have a predict method that accepts a PIL.Image.Image and returns a list of LayoutElements, and an initialize method, which loads the model and prepares it for inference.

Security Policy

See our security policy for information on how to report security vulnerabilities.

Learn more

Section Description
Unstructured Community Github Information about Unstructured.io community projects
Unstructured Github Unstructured.io open source repositories
Company Website Unstructured.io product and company info
1.6.0 Apr 01, 2026
1.5.3 Mar 26, 2026
1.5.2 Feb 13, 2026
1.2.0 Jan 30, 2026
1.1.7 Jan 20, 2026
1.1.6 Jan 20, 2026
1.1.4 Dec 31, 2025
1.1.2 Nov 21, 2025
1.1.1 Nov 05, 2025
1.0.5 Jun 03, 2025
1.0.2 May 19, 2025
0.8.10 Mar 18, 2025
0.8.9 Mar 05, 2025
0.8.8.dev0 Mar 05, 2025
0.8.7 Feb 03, 2025
0.8.6 Jan 22, 2025
0.8.5 Jan 21, 2025
0.8.4 Jan 21, 2025
0.8.3 Jan 20, 2025
0.8.2 Jan 15, 2025
0.8.1 Oct 25, 2024
0.8.0 Oct 18, 2024
0.7.41 Oct 16, 2024
0.7.40 Oct 11, 2024
0.7.39 Oct 10, 2024
0.7.38.dev0 Oct 01, 2024
0.7.37 Sep 24, 2024
0.7.36 Jun 21, 2024
0.7.35 Jun 13, 2024
0.7.34 May 28, 2024
0.7.33 May 22, 2024
0.7.32 May 21, 2024
0.7.31 May 07, 2024
0.7.29 Apr 24, 2024
0.7.28 Apr 22, 2024
0.7.27 Apr 19, 2024
0.7.26 Apr 18, 2024
0.7.25 Mar 22, 2024
0.7.24 Feb 07, 2024
0.7.23 Jan 19, 2024
0.7.21 Jan 05, 2024
0.7.20 Dec 20, 2023
0.7.19 Dec 15, 2023
0.7.18 Dec 05, 2023
0.7.17 Dec 01, 2023
0.7.16 Nov 21, 2023
0.7.15 Nov 20, 2023
0.7.14 Nov 17, 2023
0.7.13 Nov 16, 2023
0.7.12 Nov 14, 2023
0.7.11 Nov 06, 2023
0.7.10 Oct 21, 2023
0.7.9 Oct 17, 2023
0.7.8 Oct 17, 2023
0.7.7 Oct 17, 2023
0.7.6 Oct 16, 2023
0.7.5 Oct 14, 2023
0.7.4 Oct 13, 2023
0.7.3 Oct 11, 2023
0.7.2 Oct 06, 2023
0.7.1 Oct 06, 2023
0.7.0 Oct 05, 2023
0.6.6 Sep 28, 2023
0.6.5 Sep 27, 2023
0.6.4 Sep 27, 2023
0.6.3 Sep 25, 2023
0.6.1 Sep 21, 2023
0.5.31 Sep 21, 2023
0.5.28 Sep 14, 2023
0.5.27 Sep 12, 2023
0.5.25 Sep 09, 2023
0.5.24 Sep 09, 2023
0.5.23 Sep 07, 2023
0.5.22 Sep 05, 2023
0.5.21 Sep 03, 2023
0.5.20 Sep 02, 2023
0.5.19 Sep 01, 2023
0.5.18 Aug 30, 2023
0.5.17 Aug 26, 2023
0.5.16 Aug 23, 2023
0.5.15 Aug 22, 2023
0.5.14 Aug 18, 2023
0.5.13 Aug 17, 2023
0.5.12 Aug 16, 2023
0.5.11 Aug 16, 2023
0.5.10 Aug 11, 2023
0.5.9 Aug 10, 2023
0.5.8 Aug 09, 2023
0.5.7 Jul 25, 2023
0.5.6 Jul 24, 2023
0.5.5 Jul 07, 2023
0.5.4 Jun 29, 2023
0.5.3 Jun 29, 2023
0.5.2 Jun 21, 2023
0.5.1 May 30, 2023
0.5.0 May 18, 2023
0.4.4 May 05, 2023
0.4.3 May 04, 2023
0.4.2 Apr 21, 2023
0.4.1 Apr 20, 2023
0.4.0 Apr 14, 2023
0.3.2 Mar 31, 2023
0.3.1 Mar 31, 2023
0.3.0 Mar 30, 2023
0.2.11 Mar 10, 2023
0.2.10 Mar 07, 2023
0.2.7 Feb 10, 2023
0.2.5 Feb 03, 2023
0.2.4 Jan 25, 2023
0.2.3 Jan 13, 2023
0.2.2 Jan 12, 2023
0.2.1 Jan 04, 2023
0.2.0 Dec 21, 2022
Extras: None
Dependencies:
accelerate (>=1.12.0)
huggingface-hub (>=0.22.0)
matplotlib (>=3.10.8)
numpy (>=2.4.2)
onnx (>=1.20.1)
onnxruntime (>=1.18.0)
opencv-python (>=4.13.0.90)
pandas (>=3.0.0)
pypdfium2 (>=5.0.0)
rapidfuzz (>=3.14.3)
scipy (>=1.17.0)
timm (>=1.0.24)
torch (>=2.10.0)
transformers (>=4.25.1)