visual-parser 2.0.4__tar.gz → 2.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- visual_parser-2.2.0/LICENSE +201 -0
- visual_parser-2.2.0/PKG-INFO +331 -0
- visual_parser-2.2.0/README.md +286 -0
- {visual_parser-2.0.4 → visual_parser-2.2.0}/pyproject.toml +26 -19
- visual_parser-2.2.0/tests/test_cli_parity.py +193 -0
- visual_parser-2.2.0/tests/test_config.py +117 -0
- visual_parser-2.2.0/tests/test_figure_describer.py +176 -0
- visual_parser-2.2.0/tests/test_integration.py +113 -0
- visual_parser-2.2.0/tests/test_model_catalog.py +91 -0
- visual_parser-2.2.0/tests/test_ollama_local.py +292 -0
- visual_parser-2.2.0/tests/test_pipeline.py +168 -0
- visual_parser-2.2.0/tests/test_vision_llm.py +226 -0
- {visual_parser-2.0.4 → visual_parser-2.2.0}/visual_parser/__init__.py +3 -3
- {visual_parser-2.0.4 → visual_parser-2.2.0}/visual_parser/cli.py +137 -13
- {visual_parser-2.0.4 → visual_parser-2.2.0}/visual_parser/cli_main.py +64 -12
- {visual_parser-2.0.4 → visual_parser-2.2.0}/visual_parser/config.py +43 -11
- {visual_parser-2.0.4 → visual_parser-2.2.0}/visual_parser/figure_describer.py +302 -239
- {visual_parser-2.0.4 → visual_parser-2.2.0}/visual_parser/metadata_extractor.py +1 -1
- visual_parser-2.2.0/visual_parser/model_catalog.py +190 -0
- {visual_parser-2.0.4 → visual_parser-2.2.0}/visual_parser/nougat_engine.py +51 -47
- visual_parser-2.2.0/visual_parser/ollama_local.py +349 -0
- visual_parser-2.2.0/visual_parser/openai_gateway.py +84 -0
- {visual_parser-2.0.4 → visual_parser-2.2.0}/visual_parser/pipeline.py +220 -36
- {visual_parser-2.0.4 → visual_parser-2.2.0}/visual_parser/prompts.py +33 -0
- {visual_parser-2.0.4 → visual_parser-2.2.0}/visual_parser/text_extractor.py +37 -11
- visual_parser-2.2.0/visual_parser/vision_llm.py +403 -0
- visual_parser-2.2.0/visual_parser.egg-info/PKG-INFO +331 -0
- {visual_parser-2.0.4 → visual_parser-2.2.0}/visual_parser.egg-info/SOURCES.txt +12 -0
- visual_parser-2.2.0/visual_parser.egg-info/requires.txt +23 -0
- visual_parser-2.0.4/PKG-INFO +0 -200
- visual_parser-2.0.4/README.md +0 -157
- visual_parser-2.0.4/visual_parser/vision_llm.py +0 -269
- visual_parser-2.0.4/visual_parser.egg-info/PKG-INFO +0 -200
- visual_parser-2.0.4/visual_parser.egg-info/requires.txt +0 -22
- {visual_parser-2.0.4 → visual_parser-2.2.0}/setup.cfg +0 -0
- {visual_parser-2.0.4 → visual_parser-2.2.0}/visual_parser/__main__.py +0 -0
- {visual_parser-2.0.4 → visual_parser-2.2.0}/visual_parser/jsonl_writer.py +0 -0
- {visual_parser-2.0.4 → visual_parser-2.2.0}/visual_parser/pdf_tracker.py +0 -0
- {visual_parser-2.0.4 → visual_parser-2.2.0}/visual_parser.egg-info/dependency_links.txt +0 -0
- {visual_parser-2.0.4 → visual_parser-2.2.0}/visual_parser.egg-info/entry_points.txt +0 -0
- {visual_parser-2.0.4 → visual_parser-2.2.0}/visual_parser.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the
|
|
44
|
+
purposes of this License, Derivative Works shall not include works
|
|
45
|
+
that remain separable from, or merely link (or bind by name) to the
|
|
46
|
+
interfaces of, the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including the
|
|
49
|
+
original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Zavier N. Ndum
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: visual-parser
|
|
3
|
+
Version: 2.2.0
|
|
4
|
+
Summary: Standalone Visual-RAG PDF Parser - text extraction and Vision-LLM figure descriptions to JSONL
|
|
5
|
+
Author: Zavier N. Ndum
|
|
6
|
+
Author-email: zavier.ndum@tamu.edu
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
Project-URL: Homepage, https://github.com/SmartLabNuclear/RADIANT_LLM
|
|
9
|
+
Project-URL: Repository, https://github.com/SmartLabNuclear/RADIANT_LLM
|
|
10
|
+
Project-URL: Docker Hub, https://hub.docker.com/r/zev94/radiant-llm
|
|
11
|
+
Keywords: pdf,rag,nougat,vision-llm,ocr,document-parsing,jsonl,knowledge-base
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Classifier: Topic :: Text Processing :: Markup
|
|
19
|
+
Classifier: Intended Audience :: Science/Research
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: PyMuPDF>=1.23.0
|
|
24
|
+
Requires-Dist: Pillow>=10.0.0
|
|
25
|
+
Requires-Dist: torch>=2.1.0
|
|
26
|
+
Requires-Dist: transformers>=4.38.0
|
|
27
|
+
Requires-Dist: huggingface-hub>=0.36.0
|
|
28
|
+
Requires-Dist: langchain-community>=0.0.20
|
|
29
|
+
Requires-Dist: langchain>=0.1.0
|
|
30
|
+
Requires-Dist: langchain-text-splitters>=0.0.1
|
|
31
|
+
Requires-Dist: openai>=1.14.0
|
|
32
|
+
Requires-Dist: google-generativeai>=0.5.0
|
|
33
|
+
Requires-Dist: requests>=2.31.0
|
|
34
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
35
|
+
Requires-Dist: tqdm>=4.66.0
|
|
36
|
+
Requires-Dist: nltk>=3.8
|
|
37
|
+
Requires-Dist: python-Levenshtein>=0.20
|
|
38
|
+
Provides-Extra: ocr
|
|
39
|
+
Requires-Dist: pytesseract>=0.3.10; extra == "ocr"
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: pytest; extra == "dev"
|
|
42
|
+
Requires-Dist: ruff; extra == "dev"
|
|
43
|
+
Requires-Dist: mypy; extra == "dev"
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
# visual-parser (Standalone Visual-RAG PDF Ingestion)
|
|
47
|
+
|
|
48
|
+

|
|
49
|
+

|
|
50
|
+

|
|
51
|
+

|
|
52
|
+
|
|
53
|
+
`visual-parser` converts PDFs into a multi-modal JSONL knowledge base (text chunks, figure descriptions, metadata). It was extracted from [RADIANT-LLM](https://github.com/SmartLabNuclear/RADIANT_LLM) as a standalone PDF-ingestion tool, independent of any chatbot.
|
|
54
|
+
|
|
55
|
+
1) Run `visual-parser` on curated PDFs to generate JSONL KB files.
|
|
56
|
+
2) Point any downstream RAG system at the generated KB — RADIANT-LLM, AutoSAM, and AutoFLUKA all consume the identical JSONL/registry format, so the same KB works with any of them without re-parsing.
|
|
57
|
+
|
|
58
|
+
## Table of Contents
|
|
59
|
+
|
|
60
|
+
- [Outputs (JSONL KB)](#outputs-jsonl-kb)
|
|
61
|
+
- [API Keys (.env)](#api-keys-env)
|
|
62
|
+
- [Install and Run](#install-and-run)
|
|
63
|
+
- [Via pip](#via-pip)
|
|
64
|
+
- [Via Docker](#via-docker)
|
|
65
|
+
- [From source](#from-source)
|
|
66
|
+
- [Common configuration flags](#common-configuration-flags)
|
|
67
|
+
- [Local Ollama vision provider](#local-ollama-vision-provider)
|
|
68
|
+
- [Citation](#citation)
|
|
69
|
+
- [License](#license)
|
|
70
|
+
|
|
71
|
+
## Outputs (JSONL KB)
|
|
72
|
+
|
|
73
|
+
By default, the pipeline writes:
|
|
74
|
+
- `01_chunks_kb.jsonl`: chunked text extracted from PDFs (Nougat by default).
|
|
75
|
+
- `02_visuals_kb.jsonl`: figure/page visual descriptions (Vision LLM).
|
|
76
|
+
- `03_metadata_kb.jsonl`: document metadata rows (title/author/etc.).
|
|
77
|
+
|
|
78
|
+
Alongside the KB, the pipeline also writes two bookkeeping files: `04_processed_pdfs.txt` (tracks which PDFs have already been processed, so re-runs skip them unless `--rebuild`) and `05_pipeline.log` (run log at the verbosity set by `--log-level`, default `ERROR`).
|
|
79
|
+
|
|
80
|
+
## API Keys (.env)
|
|
81
|
+
|
|
82
|
+
Provide at least one provider:
|
|
83
|
+
- `OPENAI_API_KEY` (OpenAI)
|
|
84
|
+
- `GEMINI_API_KEY` (Gemini)
|
|
85
|
+
|
|
86
|
+
Set these via a `.env` file (checked, in order: `~/.config/visual-parser/.env`, a `.env` in the current directory, `$VISUAL_PARSER_ENV_FILE` if set) or as regular OS environment variables (e.g. `setx` on Windows).
|
|
87
|
+
|
|
88
|
+
Optional:
|
|
89
|
+
- `HF_TOKEN` (for gated Hugging Face models)
|
|
90
|
+
- `PORTKEY_API_KEY` + `PORTKEY_OPENAI_PROVIDER_SLUG` — routes OpenAI-family calls (vision LLM + `--list-models`) through a [Portkey](https://portkey.ai) gateway instead of OpenAI directly. Only takes effect when `OPENAI_API_KEY` is absent/empty; direct OpenAI wins when both are set. Set `VISUAL_PARSER_FORCE_PORTKEY=true` to force Portkey even when `OPENAI_API_KEY` is set at the OS/system level.
|
|
91
|
+
|
|
92
|
+
## Install and Run
|
|
93
|
+
|
|
94
|
+
Three ways to run `visual-parser`, in order of setup effort: [pip install](#via-pip), [Docker](#via-docker), or [from source](#from-source). All three share the identical CLI and flags — see [Common configuration flags](#common-configuration-flags).
|
|
95
|
+
|
|
96
|
+
### Via pip
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
pip install visual-parser
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Check the install:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
visual-parser --version
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Run against a folder of PDFs:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
visual-parser --input-dir /path/to/pdfs --output-dir /path/to/pdfs
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### GPU acceleration
|
|
115
|
+
|
|
116
|
+
`--text-mode nougat` (the default) uses a CUDA GPU automatically when one is available (`torch.cuda.is_available()`). A plain `pip install visual-parser` (or `pip install torch`) installs PyPI's default CPU-only torch wheel, even on a GPU machine. Install the matching CUDA build from PyTorch's index instead:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
pip install torch --index-url https://download.pytorch.org/whl/cu130
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Use `cu130` or newer, not `cu126` — `cu126` only covers compute capability up to `sm_90` (Hopper); on a newer GPU (e.g. Blackwell, `sm_120`), `torch.cuda.is_available()` still reports `True` but the first kernel launch fails. `cu130` covers Blackwell and every architecture `cu126` covered, and requires an r580+ NVIDIA driver. Pick the exact tag for your driver at [pytorch.org/get-started](https://pytorch.org/get-started/locally/) if `cu130` doesn't apply. Reinstalling `visual-parser` afterward does not downgrade this back to CPU. Verify with:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
python -c "import torch; print(torch.cuda.is_available(), torch.cuda.get_device_name(0) if torch.cuda.is_available() else None)"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Via Docker
|
|
129
|
+
|
|
130
|
+
Prebuilt images are on **[zev94/radiant-llm](https://hub.docker.com/r/zev94/radiant-llm)** under the **visual-parser** tags:
|
|
131
|
+
|
|
132
|
+
| Tag | Description |
|
|
133
|
+
|-----|-------------|
|
|
134
|
+
| `visual-parser-latest` | Always latest build (rolling) |
|
|
135
|
+
| `visual-parser-2.1.0` | Pinned release |
|
|
136
|
+
| `visual-parser-2.0` | Pinned release |
|
|
137
|
+
| `visual-parser-1.0.2` | Legacy |
|
|
138
|
+
| `visual-parser-1.0` | Legacy — v1.0.0, stale |
|
|
139
|
+
|
|
140
|
+
#### Install Docker
|
|
141
|
+
|
|
142
|
+
Docker Desktop (Windows/macOS) or Docker Engine (Linux).
|
|
143
|
+
|
|
144
|
+
#### Pull the image
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
docker pull zev94/radiant-llm:visual-parser-latest
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
#### Run (input and output on the same mounted folder)
|
|
151
|
+
|
|
152
|
+
Windows PowerShell:
|
|
153
|
+
```powershell
|
|
154
|
+
docker run --rm --env-file .env `
|
|
155
|
+
-v "C:\path\to\pdfs:/data" `
|
|
156
|
+
zev94/radiant-llm:visual-parser-latest `
|
|
157
|
+
--input-dir /data --output-dir /data
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Linux / WSL:
|
|
161
|
+
```bash
|
|
162
|
+
docker run --rm --env-file .env \
|
|
163
|
+
-v "/path/to/pdfs:/data" \
|
|
164
|
+
zev94/radiant-llm:visual-parser-latest \
|
|
165
|
+
--input-dir /data --output-dir /data
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
#### Run (separate output directory)
|
|
169
|
+
|
|
170
|
+
Windows PowerShell:
|
|
171
|
+
```powershell
|
|
172
|
+
docker run --rm --env-file .env `
|
|
173
|
+
-v "C:\path\to\pdfs:/data" `
|
|
174
|
+
-v "C:\path\to\out:/out" `
|
|
175
|
+
zev94/radiant-llm:visual-parser-latest `
|
|
176
|
+
--input-dir /data --output-dir /out
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
#### GPU acceleration
|
|
180
|
+
|
|
181
|
+
Add `--gpus all` to any run command above to use an NVIDIA GPU instead of CPU for `--text-mode nougat` (the default). Works out of the box with Docker Desktop's WSL2 backend; no extra `nvidia-container-toolkit` install needed on most machines. Omit it (or run on a machine with no GPU) to fall back to CPU automatically.
|
|
182
|
+
|
|
183
|
+
Requires an NVIDIA driver supporting CUDA 13.0+ (r580 or newer) on the host — check with `nvidia-smi`; update from [nvidia.com/Download](https://www.nvidia.com/Download/index.aspx) if it reports an older version. Without it, `torch.cuda.is_available()` still reports `True`, but the first Nougat inference call fails with `CUDA error: no kernel image is available`:
|
|
184
|
+
|
|
185
|
+
```powershell
|
|
186
|
+
docker run --rm --gpus all --env-file .env `
|
|
187
|
+
-v "C:\path\to\pdfs:/data" `
|
|
188
|
+
zev94/radiant-llm:visual-parser-latest `
|
|
189
|
+
--input-dir /data --output-dir /data
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
#### Troubleshooting: GPU not detected
|
|
193
|
+
|
|
194
|
+
- Confirm the host sees the GPU at all: `nvidia-smi` (run from WSL if on Windows).
|
|
195
|
+
- Confirm the driver supports CUDA 13.0+: check the `CUDA Version` line in that output — needs to read 13.0 or higher (roughly r580+). Update from [nvidia.com/Download](https://www.nvidia.com/Download/index.aspx) if it reads lower.
|
|
196
|
+
- Confirm Docker can reach the GPU: `docker run --rm --gpus all nvidia/cuda:12.2.0-base-ubuntu22.04 nvidia-smi`.
|
|
197
|
+
- If Docker Desktop's WSL2 backend still doesn't see the GPU after a driver update, restart the WSL VM: `wsl --shutdown`, then restart Docker Desktop.
|
|
198
|
+
|
|
199
|
+
#### Offline install (legacy .tar)
|
|
200
|
+
|
|
201
|
+
```powershell
|
|
202
|
+
docker load -i .\visual-parser_2.1.0.tar
|
|
203
|
+
docker images # use the tag printed by Docker
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
#### Model overrides (optional)
|
|
207
|
+
|
|
208
|
+
Default vision model is **GPT-5.4** when using `--vision-provider gpt`. Override on the command line (works identically via Docker or a plain CLI install):
|
|
209
|
+
|
|
210
|
+
```powershell
|
|
211
|
+
docker run --rm --env-file .env -v "C:\path\to\pdfs:/data" `
|
|
212
|
+
zev94/radiant-llm:visual-parser-latest `
|
|
213
|
+
--input-dir /data --output-dir /data --vision-model gpt-5.6
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### From source
|
|
217
|
+
|
|
218
|
+
Clone the repository and install dependencies directly, without packaging:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
git clone https://github.com/SmartLabNuclear/RADIANT_LLM.git
|
|
222
|
+
cd RADIANT_LLM/Visual-Parser
|
|
223
|
+
pip install -r requirements.txt
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Run the top-level script:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
python visual-parser.py --input-dir ./my_pdfs
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
or as a module:
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
python -m visual_parser --input-dir ./my_pdfs
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Both use the same CLI and flags as [Via pip](#via-pip). GPU acceleration follows the same rule: a plain `pip install -r requirements.txt` also resolves to the CPU-only torch wheel by default — see [GPU acceleration](#gpu-acceleration) under Via pip for the CUDA-build install command.
|
|
239
|
+
|
|
240
|
+
## Common configuration flags
|
|
241
|
+
|
|
242
|
+
Full flag list via `--help` — Docker:
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
docker run --rm zev94/radiant-llm:visual-parser-latest --help
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
or plain CLI:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
visual-parser --help
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
For copy-paste Docker examples (vision presets, text modes, workers, rebuild), see [`docker-usage-examples.md`](docker-usage-examples.md).
|
|
255
|
+
|
|
256
|
+
Paths:
|
|
257
|
+
- `--input-dir` / `-i` (required unless `--list-models` is given)
|
|
258
|
+
- `--output-dir` / `-o` (default: same as input)
|
|
259
|
+
|
|
260
|
+
Text extraction:
|
|
261
|
+
- `--text-mode nougat|lightweight` (default: `nougat`)
|
|
262
|
+
- `--nougat-model facebook/nougat-small`
|
|
263
|
+
- `--chunk-size 500`
|
|
264
|
+
- `--chunk-overlap 100`
|
|
265
|
+
|
|
266
|
+
Vision LLM:
|
|
267
|
+
- `--vision-provider gpt|gemini|ollama` (default: `gpt`) — see [Local Ollama vision provider](#local-ollama-vision-provider) for the `ollama` option
|
|
268
|
+
- `--vision-model gpt-5.6` (or `gpt-4o`, `gemini-2.5-flash`, etc. — run `--list-models` for what's actually live on your account; omit entirely for `ollama` to auto-select)
|
|
269
|
+
- `--vision-detail low|high|auto` (default: `low`)
|
|
270
|
+
- `--reasoning-effort minimal|none|low|medium|high|xhigh` (default: `medium`)
|
|
271
|
+
- `--metadata-pages 2`
|
|
272
|
+
- `--vision-context-pages 0` — include N adjacent pages (before and after) as context in each figure-description call, to help with figures/captions that span a page break. 0 (default) is today's single-page behavior; more context pages means more tokens per call
|
|
273
|
+
|
|
274
|
+
Performance / misc:
|
|
275
|
+
- `--max-workers 4`
|
|
276
|
+
- `--rebuild` (reprocess everything; ignore `04_processed_pdfs.txt`)
|
|
277
|
+
- `--skip-text` (skip text extraction and resume only the vision steps; use after an interrupted run)
|
|
278
|
+
- `--list-models` — print the live, currently-available vision models for whichever provider(s) you have a key configured for, then exit (no PDF processing). Reflects Portkey's catalog too when that's active.
|
|
279
|
+
- `--version` / `-V`
|
|
280
|
+
- `--log-level DEBUG|INFO|WARNING|ERROR` (default: `ERROR`)
|
|
281
|
+
|
|
282
|
+
## Local Ollama vision provider
|
|
283
|
+
|
|
284
|
+
`--vision-provider ollama` runs figure description and metadata extraction against a locally-pulled model served by [Ollama](https://ollama.com), instead of a cloud API — no API key needed, no per-call cost.
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
visual-parser --input-dir /path/to/pdfs --vision-provider ollama
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Omit `--vision-model` and the largest locally-pulled, vision-capable model that fits in currently-free GPU VRAM is auto-selected (logged to the console/`05_pipeline.log` as it's picked). To use a specific model instead, pass it explicitly:
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
visual-parser --input-dir /path/to/pdfs --vision-provider ollama --vision-model qwen2.5-vl:32b
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Auto-selection:
|
|
297
|
+
- Pull at least one vision-capable model first: `ollama pull llava` (or any other vision-capable tag).
|
|
298
|
+
- Vision capability is detected via Ollama's reported model capabilities, falling back to a name heuristic (`llava`, `vision`, `-vl`, `pixtral`, `moondream`, `minicpm-v`, `bakllava`) on older Ollama versions that don't report it.
|
|
299
|
+
- The selection budget is 85% of currently-free VRAM (not total VRAM) — this correctly leaves room for whatever else is already resident (e.g. Nougat's model during the same pipeline run) and for the model's own KV-cache/context overhead, which isn't included in its on-disk size.
|
|
300
|
+
- If no CUDA GPU is visible to the process at all — including the case of running in a Docker container without `--gpus all` while Ollama runs on the host with a real GPU — CPU-only Ollama is treated as a legitimate setup: auto-selection falls back to the smallest pulled vision-capable model instead of refusing, printing a clear warning that it's running CPU-only and will be slow. Pass an explicit `--vision-model` to pick a different one.
|
|
301
|
+
- If a real GPU *is* visible but no vision-capable model fits the free-VRAM budget, that case stays strict — auto-selection raises an error asking for an explicit `--vision-model`, rather than silently falling back to heavy CPU offload.
|
|
302
|
+
|
|
303
|
+
Reachability: checks `OLLAMA_BASE_URL` (if set) → `http://localhost:11434` → `http://host.docker.internal:11434` (the containerized case). On Docker Desktop (Windows/macOS) the container reaches a host-installed Ollama automatically; on native Linux Docker Engine, add `--add-host=host.docker.internal:host-gateway` to the `docker run` command, or set `OLLAMA_BASE_URL` directly.
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## Citation
|
|
308
|
+
|
|
309
|
+
If you use RADIANT-LLM or the accompanying evaluation materials, please cite the journal article:
|
|
310
|
+
|
|
311
|
+
```bibtex
|
|
312
|
+
@article{ndum2026retrieval,
|
|
313
|
+
title={A retrieval-augmented, domain-intelligent agentic framework for reliable decision support in safety-critical nuclear engineering},
|
|
314
|
+
author={Ndum, Zavier Ndum and Tao, Jian and Ford, John and Yim, Mansung and Liu, Yang},
|
|
315
|
+
journal={Reliability Engineering \& System Safety},
|
|
316
|
+
pages={113057},
|
|
317
|
+
year={2026},
|
|
318
|
+
publisher={Elsevier}
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Journal: *Reliability Engineering & System Safety* (2026), article 113057
|
|
323
|
+
Preprint: https://arxiv.org/abs/2604.22755
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## License
|
|
328
|
+
|
|
329
|
+
Copyright 2026 Zavier N. Ndum
|
|
330
|
+
|
|
331
|
+
This project is licensed under the Apache License 2.0, the same license as its parent project, [RADIANT-LLM](https://github.com/SmartLabNuclear/RADIANT_LLM). See the [LICENSE](https://github.com/SmartLabNuclear/RADIANT_LLM/blob/main/LICENSE) file in the RADIANT_LLM repository, or the `LICENSE` file bundled with this package, for the full license text.
|