skillfed

unstructured-inference

A library for performing inference using trained models.

unstructured-inference v1.6.13 1.2M downloads/30d#4,288 on PyPI209
Permissive license Apache-2.0 Active released

What it is and what it does

unstructured-inference provides hosted model inference for document layout analysis and element extraction. It wraps detection models (Detectron2, YOLOX) and OCR pipelines to identify and extract text regions, tables, and structural elements from PDFs and images. The core workflow detects layout regions on a page, then extracts their contents via direct text extraction, OCR, or table-specific inference.

The package is designed as a backend for the broader unstructured ecosystem—it handles the model inference layer while the unstructured package orchestrates partitioning and higher-level document processing. It requires modern Python (3.11–3.13) and a substantial dependency stack including torch, transformers, and onnxruntime, reflecting its reliance on deep-learning models for detection and OCR.

Use it for:

  • Extract structured text and table regions from PDF documents for downstream NLP or data-pipeline processing.
  • Detect and classify layout elements (headers, paragraphs, tables, images) in scanned or digital documents.
  • Integrate custom detection models by wrapping them in the UnstructuredObjectDetectionModel interface.
  • Preprocess documents for machine-learning pipelines that require clean, labeled element boundaries.
  • Build document-parsing workflows that combine layout detection with OCR for mixed-format inputs.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Runs inference on layout-parsing and document-analysis models to extract structured elements (text, tables, regions) from PDFs, images, and other document formats.

Yes, if you need to extract structured elements from documents and can meet the Python version and dependency requirements. The package is actively maintained, has no known vulnerabilities, and offers a clean API for layout-based document analysis. Install only if you accept the large dependency footprint (torch, transformers, onnxruntime) and can handle Detectron2's platform constraints—particularly on Windows, where it lacks official support.

Install

unstructured-inference on PyPI

pip

pip install unstructured-inference

uv

uv add unstructured-inference

poetry

poetry add unstructured-inference

Installing unstructured-inference

Before you install

Low friction install with a pure-Python wheel, but requires Python >=3.11, <3.14. Detectron2, needed for layoutparser models, must be installed separately and has platform constraints (not officially supported on Windows). Active maintenance with a recent release.

License in practice

Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you must include a copy of the license and note any modifications.

Quickstart

pip install unstructured-inference

from unstructured_inference.inference.layout import DocumentLayout

layout = DocumentLayout.from_file("sample.pdf")
print(layout.pages[0].elements)

Requires Python >=3.11, <3.14. Detectron2 (for layoutparser models) must be installed separately and is not officially supported on Windows.

Verify before relying

  • Whether Detectron2 installation difficulty on Windows is a practical blocker for typical use cases.
  • Performance characteristics and model accuracy on different document types (scanned vs. digital PDFs, various layouts).
  • Whether the 15 runtime dependencies (torch, transformers, onnxruntime, etc.) are all required or conditionally loaded.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (<3.14,>=3.11)
Install friction low — pure-Python wheel
Runtime dependencies 15 — accelerate, huggingface-hub, matplotlib, numpy, onnx, onnxruntime, opencv-python, pandas, pdfminer-six, pypdfium2, rapidfuzz, scipy, timm, torch, transformers
Maintenance actively maintained — 64 days since the last release
Last repo commit
First released
Downloads 1,158,796/month — #4,288 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: unstructured_inference-1.6.13-py3-none-any.whl

Keywords: CV, HTML, NLP, PDF, XML, parsing, preprocessing

Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Scientific/Engineering :: Artificial Intelligence

Tags

document layout parsingpdf element detectionocr and table extractionunstructured document preprocessinglayout analysis modelsdocument structure inferencepage element detection
document-parsinglayout-detectionocr

More Artificial Intelligence packages

Further reading