LMDX-flow
LMDX-flow is a Python toolkit designed for document information extraction using LMDX. It simplifies the process of creating prompts which contain document layout information and decoding LLM responses to extract valuable information from documents.
What is LMDX: LANGUAGE MODEL-BASED DOCUMENT INFORMATION EXTRACTION AND LOCALIZATION?
LMDX is a methodology for leveraging off-the-shelf LLMs for information extraction on semi-structured documents.
Paper : https://arxiv.org/pdf/2309.10952.pdf
- Proposes a prompt that enables LLMs to perform the document IE task on leaf and hierarchical entities with precise localization, including without any training data.
- Proposes a layout encoding scheme that communicate spatial information to the LLM without any change to its architecture.
- Introduces a decoding algorithm transforming the LLM responses into extracted entities and their bounding boxes on the document, while discarding all hallucination.
Key Features
- Prompt Generation: Easily create effective prompts based on the LMDX methodology.
- Response Decoding: Extract entity values and bounding boxes by decoding and grounding the LLM responses.
Getting Started
pip install lmdx-flow
## Load the tokenizer
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
from lmdx_flow import Pipeline
P = Pipeline(file_path,tokenizer)
prompts = P.generate_prompt(schema)
answers = P.postprocess_all_chunks(llm_responses)
To-do
- Add support for hierarchical entities
- Add option to use OCR-words as segment (currently uses OCR-lines as segment)
References
Explore the potential of LMDX-flow to enhance document information extraction using LLMs with ease.
Metadata
Release files for lmdx-flow 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lmdx_flow-0.1.2.tar.gz | 5.1 kB | Without provenance | Details for lmdx_flow-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lmdx_flow-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for lmdx_flow-0.1.2-py3-none-any.whl |
Total release size: 10.8 kB
Release files / lmdx_flow-0.1.2.tar.gz
| Download URL | lmdx_flow-0.1.2.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f49c1adb4b90b0e25b6ee4eef37cf7719894b666b6e85876fd40bbbaf141bc8
|
|
BLAKE2b-256 checksum How to use checksums |
ca39c87f0f34b0f68b0a58ca1ccc6ac36e0068e007b560506e630a32c0bfff2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.9.7 Darwin/21.6.0
|
Release files / lmdx_flow-0.1.2-py3-none-any.whl
| Download URL | lmdx_flow-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83b033688c4d0c9494e40089e6327fbfb75ad3e27b7bce603f886dd6841b2d50
|
|
BLAKE2b-256 checksum How to use checksums |
d9218b7d08aee58c497ac9a414b2a797abbbad099754137224ed2b5e7346e290
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.9.7 Darwin/21.6.0
|
Security for lmdx-flow 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.