vlmparse 0.1.9__py3-none-any.whl → 0.1.10__py3-none-any.whl
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.
- vlmparse/cli.py +8 -9
- vlmparse/converter_with_server.py +15 -15
- {vlmparse-0.1.9.dist-info → vlmparse-0.1.10.dist-info}/METADATA +6 -6
- {vlmparse-0.1.9.dist-info → vlmparse-0.1.10.dist-info}/RECORD +8 -8
- {vlmparse-0.1.9.dist-info → vlmparse-0.1.10.dist-info}/WHEEL +0 -0
- {vlmparse-0.1.9.dist-info → vlmparse-0.1.10.dist-info}/entry_points.txt +0 -0
- {vlmparse-0.1.9.dist-info → vlmparse-0.1.10.dist-info}/licenses/LICENSE +0 -0
- {vlmparse-0.1.9.dist-info → vlmparse-0.1.10.dist-info}/top_level.txt +0 -0
vlmparse/cli.py
CHANGED
|
@@ -15,8 +15,8 @@ def serve(
|
|
|
15
15
|
None,
|
|
16
16
|
help='Comma-separated GPU device IDs (e.g., "0" or "0,1,2"). If not specified, all GPUs will be used.',
|
|
17
17
|
),
|
|
18
|
-
|
|
19
|
-
"registry", help="
|
|
18
|
+
provider: Literal["registry", "hf"] = typer.Option(
|
|
19
|
+
"registry", help="provider type for the model. 'registry' (default) or 'hf'."
|
|
20
20
|
),
|
|
21
21
|
vllm_args: list[str] | None = typer.Option(
|
|
22
22
|
None,
|
|
@@ -48,7 +48,7 @@ def serve(
|
|
|
48
48
|
model=model,
|
|
49
49
|
gpus=gpus,
|
|
50
50
|
port=port,
|
|
51
|
-
|
|
51
|
+
provider=provider,
|
|
52
52
|
vllm_args=vllm_args,
|
|
53
53
|
forget_predefined_vllm_args=forget_predefined_vllm_args,
|
|
54
54
|
auto_stop=False,
|
|
@@ -99,7 +99,7 @@ def convert(
|
|
|
99
99
|
"image_description (describe the image), formula (formula extraction), chart (chart recognition)"
|
|
100
100
|
),
|
|
101
101
|
),
|
|
102
|
-
|
|
102
|
+
provider: Literal["registry", "hf", "google", "openai"] = typer.Option(
|
|
103
103
|
"registry",
|
|
104
104
|
help="Server type for the model. Defaults to 'registry'.",
|
|
105
105
|
),
|
|
@@ -127,21 +127,20 @@ def convert(
|
|
|
127
127
|
gpus: Comma-separated GPU device IDs (e.g., "0" or "0,1,2"). If not specified, all GPUs will be used.
|
|
128
128
|
mode: Output mode - "document" (save as JSON zip), "md" (save as markdown file), "md_page" (save as folder of markdown pages)
|
|
129
129
|
conversion_mode: Conversion mode - "ocr" (plain), "ocr_layout" (OCR with layout), "table" (table-centric), "image_description" (describe the image), "formula" (formula extraction), "chart" (chart recognition)
|
|
130
|
-
|
|
131
|
-
with_vllm_server: Deprecated. Use --server hf instead. If True, a local VLLM server will be deployed if the model is not found in the registry. Note that if the model is in the registry and the uri is None, the server will be anyway deployed.
|
|
130
|
+
provider: provider type for the model. Defaults to 'registry'.
|
|
132
131
|
dpi: DPI to use for the conversion. If not specified, the default DPI will be used.
|
|
133
132
|
debug: If True, run in debug mode (single-threaded, no concurrency)
|
|
134
133
|
"""
|
|
135
134
|
from vlmparse.converter_with_server import ConverterWithServer
|
|
136
135
|
|
|
137
|
-
if with_vllm_server and
|
|
138
|
-
|
|
136
|
+
if with_vllm_server and provider == "registry":
|
|
137
|
+
provider = "hf"
|
|
139
138
|
|
|
140
139
|
with ConverterWithServer(
|
|
141
140
|
model=model,
|
|
142
141
|
uri=uri,
|
|
143
142
|
gpus=gpus,
|
|
144
|
-
|
|
143
|
+
provider=provider,
|
|
145
144
|
concurrency=concurrency,
|
|
146
145
|
return_documents=_return_documents,
|
|
147
146
|
) as converter_with_server:
|
|
@@ -14,7 +14,7 @@ def start_server(
|
|
|
14
14
|
model: str,
|
|
15
15
|
gpus: str,
|
|
16
16
|
port: None | int = None,
|
|
17
|
-
|
|
17
|
+
provider: Literal["registry", "hf"] = "registry",
|
|
18
18
|
vllm_args: list[str] = {},
|
|
19
19
|
forget_predefined_vllm_args: bool = False,
|
|
20
20
|
auto_stop: bool = False,
|
|
@@ -33,12 +33,12 @@ def start_server(
|
|
|
33
33
|
port = DEFAULT_SERVER_PORT
|
|
34
34
|
|
|
35
35
|
if docker_config is None:
|
|
36
|
-
if
|
|
36
|
+
if provider == "registry":
|
|
37
37
|
print(f"DEBUG: Registry lookup failed for {model} (strict mode)")
|
|
38
38
|
raise ValueError(
|
|
39
|
-
f"Model '{model}' not found in registry and
|
|
39
|
+
f"Model '{model}' not found in registry and provider='registry'. Use provider='hf' to serve arbitrary HuggingFace models."
|
|
40
40
|
)
|
|
41
|
-
elif
|
|
41
|
+
elif provider == "hf":
|
|
42
42
|
docker_config = VLLMDockerServerConfig(
|
|
43
43
|
model_name=model, default_model_name=DEFAULT_MODEL_NAME
|
|
44
44
|
)
|
|
@@ -65,14 +65,14 @@ def start_server(
|
|
|
65
65
|
logger.info(
|
|
66
66
|
f"Deploying server for {docker_config.model_name} on port {port}..."
|
|
67
67
|
)
|
|
68
|
-
|
|
69
|
-
if
|
|
68
|
+
provider = docker_config.get_server(auto_stop=auto_stop)
|
|
69
|
+
if provider is None:
|
|
70
70
|
logger.error(f"Model server not found for model: {model}")
|
|
71
71
|
return "", container, None, docker_config
|
|
72
72
|
|
|
73
|
-
base_url, container =
|
|
73
|
+
base_url, container = provider.start()
|
|
74
74
|
|
|
75
|
-
return base_url, container,
|
|
75
|
+
return base_url, container, provider, docker_config
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
class ConverterWithServer:
|
|
@@ -82,7 +82,7 @@ class ConverterWithServer:
|
|
|
82
82
|
uri: str | None = None,
|
|
83
83
|
gpus: str | None = None,
|
|
84
84
|
port: int | None = None,
|
|
85
|
-
|
|
85
|
+
provider: Literal["registry", "hf", "google", "openai"] = "registry",
|
|
86
86
|
concurrency: int = 10,
|
|
87
87
|
vllm_args: dict | None = None,
|
|
88
88
|
forget_predefined_vllm_args: bool = False,
|
|
@@ -98,7 +98,7 @@ class ConverterWithServer:
|
|
|
98
98
|
self.uri = uri
|
|
99
99
|
self.port = port
|
|
100
100
|
self.gpus = gpus
|
|
101
|
-
self.
|
|
101
|
+
self.provider = provider
|
|
102
102
|
self.concurrency = concurrency
|
|
103
103
|
self.vllm_args = vllm_args
|
|
104
104
|
self.forget_predefined_vllm_args = forget_predefined_vllm_args
|
|
@@ -118,19 +118,19 @@ class ConverterWithServer:
|
|
|
118
118
|
|
|
119
119
|
start_local_server = False
|
|
120
120
|
if self.uri is None:
|
|
121
|
-
if self.
|
|
121
|
+
if self.provider == "hf":
|
|
122
122
|
start_local_server = True
|
|
123
|
-
elif self.
|
|
123
|
+
elif self.provider == "registry":
|
|
124
124
|
if self.model in docker_config_registry.list_models():
|
|
125
125
|
start_local_server = True
|
|
126
126
|
|
|
127
127
|
if start_local_server:
|
|
128
|
-
server_arg = "hf" if self.
|
|
128
|
+
server_arg = "hf" if self.provider == "hf" else "registry"
|
|
129
129
|
_, _, self.server, docker_config = start_server(
|
|
130
130
|
model=self.model,
|
|
131
131
|
gpus=self.gpus,
|
|
132
132
|
port=self.port,
|
|
133
|
-
|
|
133
|
+
provider=server_arg,
|
|
134
134
|
vllm_args=self.vllm_args,
|
|
135
135
|
forget_predefined_vllm_args=self.forget_predefined_vllm_args,
|
|
136
136
|
auto_stop=True,
|
|
@@ -146,7 +146,7 @@ class ConverterWithServer:
|
|
|
146
146
|
return_documents_in_batch_mode=self.return_documents
|
|
147
147
|
)
|
|
148
148
|
|
|
149
|
-
elif self.
|
|
149
|
+
elif self.provider == "hf":
|
|
150
150
|
client_config = OpenAIConverterConfig(
|
|
151
151
|
model_name=self.model, base_url=self.uri
|
|
152
152
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vlmparse
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.10
|
|
4
4
|
Requires-Python: >=3.11.0
|
|
5
5
|
Description-Content-Type: text/markdown
|
|
6
6
|
License-File: LICENSE
|
|
@@ -56,7 +56,7 @@ Dynamic: license-file
|
|
|
56
56
|
|
|
57
57
|
<div align="center">
|
|
58
58
|
|
|
59
|
-
[\[📜 arXiv coming soon\]] | [[Dataset (🤗Hugging Face)]](https://huggingface.co/datasets/pulsia/fr-bench-pdf2md) | [[pypi]](https://pypi.org/project/vlmparse/) | [[vlmparse]](https://github.com/ld-lab-pulsia/vlmparse) | [[Benchmark]](https://github.com/ld-lab-pulsia/benchpdf2md)
|
|
59
|
+
[\[📜 arXiv coming soon\]] | [[Dataset (🤗Hugging Face)]](https://huggingface.co/datasets/pulsia/fr-bench-pdf2md) | [[pypi]](https://pypi.org/project/vlmparse/) | [[vlmparse]](https://github.com/ld-lab-pulsia/vlmparse) | [[Benchmark]](https://github.com/ld-lab-pulsia/benchpdf2md) | [[Leaderboard]](https://huggingface.co/spaces/pulsia/fr-bench-pdf2md)
|
|
60
60
|
|
|
61
61
|
</div>
|
|
62
62
|
|
|
@@ -71,7 +71,7 @@ Features:
|
|
|
71
71
|
|
|
72
72
|
Supported Converters:
|
|
73
73
|
|
|
74
|
-
- **Open Source Small VLMs**: `
|
|
74
|
+
- **Open Source Small VLMs**: `lightonocr2`, `mineru2.5`, `hunyuanocr`, `paddleocrvl-1.5`, `granite-docling`, `olmocr2-fp8`, `dotsocr`, `chandra`, `deepseekocr2`, `nanonets/Nanonets-OCR2-3B`
|
|
75
75
|
- **Open Source Generalist VLMs**: such as the Qwen family.
|
|
76
76
|
- **Pipelines**: `docling`
|
|
77
77
|
- **Proprietary LLMs**: `gemini`, `gpt`
|
|
@@ -115,13 +115,13 @@ Note that you can bypass the previous installation step and just add uvx before
|
|
|
115
115
|
With a general VLM (requires setting your api key as an environment variable):
|
|
116
116
|
|
|
117
117
|
```bash
|
|
118
|
-
vlmparse convert
|
|
118
|
+
vlmparse convert "*.pdf" --out_folder ./output --model gemini-2.5-flash-lite
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
Convert with auto deployment of a small vlm (or any huggingface VLM model, requires a gpu + docker installation):
|
|
122
122
|
|
|
123
123
|
```bash
|
|
124
|
-
vlmparse convert
|
|
124
|
+
vlmparse convert "*.pdf" --out_folder ./output --model nanonets/Nanonets-OCR2-3B
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
### Deploy a local model server
|
|
@@ -131,7 +131,7 @@ Deployment (requires a gpu + docker installation):
|
|
|
131
131
|
- Check that the port is not used by another service.
|
|
132
132
|
|
|
133
133
|
```bash
|
|
134
|
-
vlmparse serve
|
|
134
|
+
vlmparse serve lightonocr2 --port 8000 --gpus 1
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
then convert:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
vlmparse/base_model.py,sha256=4U4UPe8SNArliKnUf8pp8zQugWYsnhg9okylt7mrW1U,381
|
|
2
2
|
vlmparse/build_doc.py,sha256=fb7awoqVN-6NBlKVkMFb1v1iTWcxne5QAyNaKYTyvM4,2275
|
|
3
|
-
vlmparse/cli.py,sha256=
|
|
3
|
+
vlmparse/cli.py,sha256=jP_BnFaeW1rm3iTcdw5WFRfQUgDYd6HC1Zh-5JbE9_4,18285
|
|
4
4
|
vlmparse/constants.py,sha256=DYaK7KtTW8p9MPb3iPvoP5H1r7ICRuIFo89P01q4uCI,184
|
|
5
5
|
vlmparse/converter.py,sha256=KKcXqrp3nJo3d7DXjHn3O2SklbsJ489rDY4NJ9O42Fs,8795
|
|
6
|
-
vlmparse/converter_with_server.py,sha256=
|
|
6
|
+
vlmparse/converter_with_server.py,sha256=nDGF-FEqskAECam_Sm8GbPMGPdI2Iua4lHaHbpMZx_k,8872
|
|
7
7
|
vlmparse/registries.py,sha256=4xiDKyIzAW68ZWyOtUmBOvzcXVqTPPdeoxD2s9RbjZ0,6714
|
|
8
8
|
vlmparse/utils.py,sha256=6Ff9OfAIVR-4_37QD5sifoNt_GmB3YUqgFwmIjuemtc,1727
|
|
9
9
|
vlmparse/clients/chandra.py,sha256=zAHjgI_MJ5FVGANHCG8KJQByaw6-zTS6CHXsCBA8TJI,13025
|
|
@@ -36,9 +36,9 @@ vlmparse/servers/server_registry.py,sha256=FUF_XnN8872vKnc8-TrEBntwBS5i3ZYVJvTHr
|
|
|
36
36
|
vlmparse/servers/utils.py,sha256=rbqn9i6XB1YOEFluP4Ur0Ma40_6riUxJ1eMS8LSWbKs,3998
|
|
37
37
|
vlmparse/st_viewer/fs_nav.py,sha256=7GNH68h2Loh5pQ64Pe72-D2cs2BLhqRXevEmKdFmPX0,1616
|
|
38
38
|
vlmparse/st_viewer/st_viewer.py,sha256=wg0qfhAKdvnkpc3xDK8QnWP9adjEThzeS-I5vHGDhIU,2132
|
|
39
|
-
vlmparse-0.1.
|
|
40
|
-
vlmparse-0.1.
|
|
41
|
-
vlmparse-0.1.
|
|
42
|
-
vlmparse-0.1.
|
|
43
|
-
vlmparse-0.1.
|
|
44
|
-
vlmparse-0.1.
|
|
39
|
+
vlmparse-0.1.10.dist-info/licenses/LICENSE,sha256=3TKJHk8hPBR5dbLWZ3IpfCftl-_m-iyBwpYQGZYxj14,1080
|
|
40
|
+
vlmparse-0.1.10.dist-info/METADATA,sha256=OIRlJUlRioNzrehJIK2dmBcTFHI7A6H5uedu-EzDTQA,6077
|
|
41
|
+
vlmparse-0.1.10.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
42
|
+
vlmparse-0.1.10.dist-info/entry_points.txt,sha256=gD5berP6HwE2wNIkls-Lw5goiceA8uMgPEd7ifnFJXs,47
|
|
43
|
+
vlmparse-0.1.10.dist-info/top_level.txt,sha256=k4ni-GNH_iAX7liQEsk_KY_c3xgZgt8k9fsSs9IXLXs,9
|
|
44
|
+
vlmparse-0.1.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|