unstructured-inference
A library for performing inference using trained models.
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-inferenceuv
uv add unstructured-inferencepoetry
poetry add unstructured-inferenceInstalling 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
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
layoutparserLayoutParser provides deep learning-based…
permissive · top 5,000 on PyPI
unstructuredIngests and pre-processes unstructured…
permissive · top 5,000 on PyPI
unstructured-clientHTTP client SDK for the Unstructured Platform…
permissive · top 5,000 on PyPI
paddleocrPaddleOCR extracts text, tables, and structured…
permissive · top 5,000 on PyPI
surya-ocrSurya is an OCR and document intelligence model…
permissive · top 5,000 on PyPI
docling-ibm-modelsProvides AI models for table structure…
permissive · top 5,000 on PyPI
opendataloader-pdfExtracts structured data (Markdown, JSON, HTML)…
permissive · top 15,000 on PyPI
marker-pdfMarker converts PDFs, images, and other…
permissive · top 15,000 on PyPI
pymupdf-layoutPyMuPDF Layout analyzes PDF structure and…
agpl · top 1,000 on PyPI
img2tableIdentifies and extracts tables from images and…
permissive · top 15,000 on PyPI