[Doc] Host model recipes in recipes/ (#61302)
Signed-off-by: esmeetu <jasonailu87@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f98ae6a9fd
commit
b515648641
@@ -0,0 +1,204 @@
|
||||
meta:
|
||||
title: "PaddleOCR-VL-1.5"
|
||||
slug: "paddleocr-vl-1.5"
|
||||
provider: "PaddlePaddle"
|
||||
description: "PaddleOCR-VL-1.5 (0.9B) — next-gen compact VLM for document parsing; adds text spotting, seal recognition, and Tibetan/Bengali"
|
||||
date_added: 2026-05-11
|
||||
date_updated: 2026-05-11
|
||||
tasks:
|
||||
- multimodal
|
||||
related_recipes:
|
||||
- "PaddlePaddle/PaddleOCR-VL"
|
||||
|
||||
model:
|
||||
model_id: "PaddlePaddle/PaddleOCR-VL-1.5"
|
||||
min_vllm_version: "0.11.1"
|
||||
architecture: dense
|
||||
parameter_count: "0.9B"
|
||||
active_parameters: "0.9B"
|
||||
context_length: 131072
|
||||
base_args:
|
||||
- "--trust-remote-code"
|
||||
- "--max-num-batched-tokens"
|
||||
- "16384"
|
||||
- "--no-enable-prefix-caching"
|
||||
- "--mm-processor-cache-gb"
|
||||
- "0"
|
||||
base_env: {}
|
||||
|
||||
dependencies:
|
||||
- note: "PaddlePaddle runtime (install in a separate venv from vllm to avoid conflicts)"
|
||||
command: "uv pip install paddlepaddle-gpu==3.2.1 --extra-index-url https://www.paddlepaddle.org.cn/packages/stable/cu126/"
|
||||
- note: "PaddleOCR document-parsing helpers (1.5 ships under the same paddleocr[doc-parser] extra)"
|
||||
command: 'uv pip install -U "paddleocr[doc-parser]"'
|
||||
- note: "Safetensors loader used by the doc-parser path"
|
||||
command: "uv pip install safetensors"
|
||||
|
||||
features:
|
||||
text_only:
|
||||
description: "Skip loading the vision encoder for text-only workloads — frees VRAM for KV cache. Mutually exclusive with encoder_parallel."
|
||||
args:
|
||||
- "--language-model-only"
|
||||
encoder_parallel:
|
||||
description: "Run the vision encoder in data-parallel mode — avoids TP comm overhead on the small encoder. Mutually exclusive with text_only."
|
||||
args:
|
||||
- "--mm-encoder-tp-mode"
|
||||
- "data"
|
||||
|
||||
opt_in_features:
|
||||
- text_only
|
||||
- encoder_parallel
|
||||
|
||||
variants:
|
||||
default:
|
||||
precision: bf16
|
||||
vram_minimum_gb: 2
|
||||
description: "BF16 weights — small footprint, runs on most GPUs"
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- multi_node_tp
|
||||
|
||||
kv_offload_support:
|
||||
offloading_cpu: verified
|
||||
offloading_fs: verified
|
||||
|
||||
hardware_overrides:
|
||||
amd:
|
||||
extra_args: []
|
||||
extra_env:
|
||||
SAFETENSORS_FAST_GPU: "1"
|
||||
strategy_overrides: {}
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
[PaddleOCR-VL-1.5](https://huggingface.co/PaddlePaddle/PaddleOCR-VL-1.5) is the next
|
||||
generation of PaddleOCR-VL — same 0.9B architecture (NaViT-style dynamic-resolution
|
||||
vision encoder + ERNIE-4.5-0.3B LM), with substantial accuracy gains and new tasks:
|
||||
|
||||
- **94.5% on OmniDocBench v1.5** (SOTA)
|
||||
- **Text spotting** — line-level localization + recognition in one pass
|
||||
- **Seal recognition** — new task with SOTA results
|
||||
- **Irregular-shape localization** — polygonal detection under skew/warping
|
||||
- **Multilingual** — adds Tibetan and Bengali
|
||||
- Cross-page table merging and paragraph-heading recognition
|
||||
|
||||
Architecture is identical to PaddleOCR-VL, so the vLLM launch command and feature
|
||||
flags are the same.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Hardware: 1x GPU (small VRAM footprint)
|
||||
- vLLM >= 0.11.1 (nightly if not released yet)
|
||||
- AMD ROCm wheels require Python 3.12, ROCm 7.2.3, and glibc >= 2.35.
|
||||
|
||||
### Install vLLM (NVIDIA)
|
||||
|
||||
```bash
|
||||
uv venv
|
||||
source .venv/bin/activate
|
||||
uv pip install -U vllm --pre \
|
||||
--extra-index-url https://wheels.vllm.ai/nightly \
|
||||
--extra-index-url https://download.pytorch.org/whl/cu129 \
|
||||
--index-strategy unsafe-best-match
|
||||
```
|
||||
|
||||
### Install vLLM (AMD ROCm)
|
||||
|
||||
```bash
|
||||
uv venv --python 3.12
|
||||
source .venv/bin/activate
|
||||
uv pip install vllm --extra-index-url https://wheels.vllm.ai/rocm
|
||||
```
|
||||
|
||||
## Launch command
|
||||
|
||||
```bash
|
||||
vllm serve PaddlePaddle/PaddleOCR-VL-1.5 \
|
||||
--trust-remote-code \
|
||||
--max-num-batched-tokens 16384 \
|
||||
--no-enable-prefix-caching \
|
||||
--mm-processor-cache-gb 0
|
||||
```
|
||||
|
||||
AMD MI300X/MI325X/MI355X:
|
||||
|
||||
```bash
|
||||
export SAFETENSORS_FAST_GPU=1
|
||||
|
||||
vllm serve PaddlePaddle/PaddleOCR-VL-1.5 \
|
||||
--trust-remote-code \
|
||||
--max-num-batched-tokens 16384 \
|
||||
--mm-processor-cache-gb 0
|
||||
```
|
||||
|
||||
Tip: OCR workloads don't benefit much from prefix caching or image reuse, so disable
|
||||
those to avoid hashing/caching overhead.
|
||||
|
||||
## Client Usage
|
||||
|
||||
Task-specific prompts (note the two new tasks `spotting` and `seal`):
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1", timeout=3600)
|
||||
|
||||
TASKS = {
|
||||
"ocr": "OCR:",
|
||||
"table": "Table Recognition:",
|
||||
"formula": "Formula Recognition:",
|
||||
"chart": "Chart Recognition:",
|
||||
"spotting": "Spotting:",
|
||||
"seal": "Seal Recognition:",
|
||||
}
|
||||
|
||||
response = client.chat.completions.create(
|
||||
model="PaddlePaddle/PaddleOCR-VL-1.5",
|
||||
messages=[{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "image_url", "image_url": {"url": "https://.../receipt.png"}},
|
||||
{"type": "text", "text": TASKS["spotting"]},
|
||||
],
|
||||
}],
|
||||
temperature=0.0,
|
||||
)
|
||||
print(response.choices[0].message.content)
|
||||
```
|
||||
|
||||
## Offline Inference with PP-DocLayoutV2
|
||||
|
||||
Use separate venvs for `vllm` and `paddlepaddle` to avoid conflicts. If you see
|
||||
"The model PaddleOCR-VL-1.5-0.9B does not exist.", add
|
||||
`--served-model-name PaddleOCR-VL-1.5-0.9B`.
|
||||
|
||||
```bash
|
||||
uv pip install paddlepaddle-gpu==3.2.1 --extra-index-url https://www.paddlepaddle.org.cn/packages/stable/cu126/
|
||||
uv pip install -U "paddleocr[doc-parser]"
|
||||
uv pip install safetensors
|
||||
```
|
||||
|
||||
```python
|
||||
from paddleocr import PaddleOCRVL
|
||||
|
||||
pipeline = PaddleOCRVL(
|
||||
vl_rec_model_name="PaddleOCR-VL-1.5-0.9B",
|
||||
vl_rec_backend="vllm-server",
|
||||
vl_rec_server_url="http://localhost:8000/v1",
|
||||
layout_detection_model_name="PP-DocLayoutV2",
|
||||
layout_detection_model_dir="/path/to/your/PP-DocLayoutV2/",
|
||||
)
|
||||
|
||||
output = pipeline.predict("https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/paddleocr_vl_demo.png")
|
||||
for i, res in enumerate(output):
|
||||
res.save_to_json(save_path=f"output_{i}.json")
|
||||
res.save_to_markdown(save_path=f"output_{i}.md")
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
- [PaddleOCR-VL-1.5 on Hugging Face](https://huggingface.co/PaddlePaddle/PaddleOCR-VL-1.5)
|
||||
- [PaddleOCR GitHub](https://github.com/PaddlePaddle/PaddleOCR)
|
||||
- [vLLM support tracking issue](https://github.com/vllm-project/vllm/issues/33554)
|
||||
@@ -0,0 +1,187 @@
|
||||
meta:
|
||||
title: "PaddleOCR-VL-1.6"
|
||||
slug: "paddleocr-vl-1.6"
|
||||
provider: "PaddlePaddle"
|
||||
description: "PaddleOCR-VL-1.6 (0.9B) — region-aware data optimization + progressive post-training; new SOTA 96.33% on OmniDocBench v1.6, drop-in replacement for 1.5"
|
||||
date_added: 2026-07-11
|
||||
date_updated: 2026-07-08
|
||||
tasks:
|
||||
- multimodal
|
||||
related_recipes:
|
||||
- "PaddlePaddle/PaddleOCR-VL-1.5"
|
||||
- "PaddlePaddle/PaddleOCR-VL"
|
||||
|
||||
model:
|
||||
model_id: "PaddlePaddle/PaddleOCR-VL-1.6"
|
||||
min_vllm_version: "0.11.1"
|
||||
architecture: dense
|
||||
parameter_count: "0.9B"
|
||||
active_parameters: "0.9B"
|
||||
context_length: 131072
|
||||
base_args:
|
||||
- "--trust-remote-code"
|
||||
- "--max-num-batched-tokens"
|
||||
- "16384"
|
||||
- "--no-enable-prefix-caching"
|
||||
- "--mm-processor-cache-gb"
|
||||
- "0"
|
||||
base_env: {}
|
||||
|
||||
dependencies:
|
||||
- note: "PaddlePaddle runtime (install in a separate venv from vllm to avoid conflicts)"
|
||||
command: "uv pip install paddlepaddle-gpu==3.2.1 --extra-index-url https://www.paddlepaddle.org.cn/packages/stable/cu126/"
|
||||
brand: NVIDIA
|
||||
- note: "PaddleOCR document-parsing helpers — 1.6 requires >= 3.6.0 (pipeline_version v1.6)"
|
||||
command: 'uv pip install -U "paddleocr[doc-parser]>=3.6.0"'
|
||||
- note: "Safetensors loader used by the doc-parser path"
|
||||
command: "uv pip install safetensors"
|
||||
|
||||
features:
|
||||
text_only:
|
||||
description: "Skip loading the vision encoder for text-only workloads — frees VRAM for KV cache. Mutually exclusive with encoder_parallel."
|
||||
args:
|
||||
- "--language-model-only"
|
||||
encoder_parallel:
|
||||
description: "Run the vision encoder in data-parallel mode — avoids TP comm overhead on the small encoder. Mutually exclusive with text_only."
|
||||
args:
|
||||
- "--mm-encoder-tp-mode"
|
||||
- "data"
|
||||
|
||||
opt_in_features:
|
||||
- text_only
|
||||
- encoder_parallel
|
||||
|
||||
variants:
|
||||
default:
|
||||
precision: bf16
|
||||
vram_minimum_gb: 2
|
||||
description: "BF16 weights — small footprint, runs on most GPUs"
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- multi_node_tp
|
||||
|
||||
kv_offload_support:
|
||||
offloading_cpu: verified
|
||||
offloading_fs: verified
|
||||
|
||||
hardware_overrides:
|
||||
amd:
|
||||
extra_args: []
|
||||
extra_env:
|
||||
SAFETENSORS_FAST_GPU: "1"
|
||||
strategy_overrides: {}
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
[PaddleOCR-VL-1.6](https://huggingface.co/PaddlePaddle/PaddleOCR-VL-1.6) upgrades
|
||||
PaddleOCR-VL-1.5 with a region-aware data optimization framework (targeted enhancement
|
||||
of weak regions found in the previous model) and a progressive post-training recipe
|
||||
based on curated data selection and reinforcement learning:
|
||||
|
||||
- **96.33% on OmniDocBench v1.6** (new SOTA), plus new records on OmniDocBench v1.5
|
||||
and Real5-OmniDocBench (scanning, warping, screen-photography, illumination, skew)
|
||||
- Major gains in table, Chinese ancient document, and Chinese rare character recognition
|
||||
- Improved seal/stamp recognition, text spotting, and chart recognition
|
||||
|
||||
The architecture is **fully compatible with PaddleOCR-VL-1.5** (same 0.9B NaViT-style
|
||||
dynamic-resolution vision encoder + ERNIE-4.5-0.3B LM), so migration is plug-and-play:
|
||||
the vLLM launch command and feature flags are unchanged.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Hardware: 1x GPU (small VRAM footprint)
|
||||
- vLLM >= 0.11.1
|
||||
|
||||
### Install vLLM
|
||||
|
||||
```bash
|
||||
uv venv
|
||||
source .venv/bin/activate
|
||||
uv pip install -U vllm
|
||||
```
|
||||
|
||||
## Launch command
|
||||
|
||||
```bash
|
||||
vllm serve PaddlePaddle/PaddleOCR-VL-1.6 \
|
||||
--trust-remote-code \
|
||||
--max-num-batched-tokens 16384 \
|
||||
--no-enable-prefix-caching \
|
||||
--mm-processor-cache-gb 0
|
||||
```
|
||||
|
||||
Tip: OCR workloads don't benefit much from prefix caching or image reuse, so disable
|
||||
those to avoid hashing/caching overhead.
|
||||
|
||||
## Client Usage
|
||||
|
||||
Task-specific prompts (same task set as 1.5, including `spotting` and `seal`):
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1", timeout=3600)
|
||||
|
||||
TASKS = {
|
||||
"ocr": "OCR:",
|
||||
"table": "Table Recognition:",
|
||||
"formula": "Formula Recognition:",
|
||||
"chart": "Chart Recognition:",
|
||||
"spotting": "Spotting:",
|
||||
"seal": "Seal Recognition:",
|
||||
}
|
||||
|
||||
response = client.chat.completions.create(
|
||||
model="PaddlePaddle/PaddleOCR-VL-1.6",
|
||||
messages=[{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "image_url", "image_url": {"url": "https://.../receipt.png"}},
|
||||
{"type": "text", "text": TASKS["spotting"]},
|
||||
],
|
||||
}],
|
||||
temperature=0.0,
|
||||
)
|
||||
print(response.choices[0].message.content)
|
||||
```
|
||||
|
||||
## Offline Inference with PP-DocLayoutV3
|
||||
|
||||
Use separate venvs for `vllm` and `paddlepaddle` to avoid conflicts. The 1.6 pipeline
|
||||
requires `paddleocr[doc-parser] >= 3.6.0` and `pipeline_version="v1.6"`, which
|
||||
automatically uses [PP-DocLayoutV3](https://huggingface.co/PaddlePaddle/PP-DocLayoutV3)
|
||||
for layout detection (PP-DocLayoutV2 belongs to the v1 pipeline). Pass
|
||||
`vl_rec_api_model_name="PaddlePaddle/PaddleOCR-VL-1.6"` so the client matches the
|
||||
model name the vLLM server exposes — otherwise it defaults to
|
||||
`PaddleOCR-VL-1.6-0.9B` and fails with "The model PaddleOCR-VL-1.6-0.9B does not exist."
|
||||
|
||||
```bash
|
||||
uv pip install paddlepaddle-gpu==3.2.1 --extra-index-url https://www.paddlepaddle.org.cn/packages/stable/cu126/
|
||||
uv pip install -U "paddleocr[doc-parser]>=3.6.0"
|
||||
uv pip install safetensors
|
||||
```
|
||||
|
||||
```python
|
||||
from paddleocr import PaddleOCRVL
|
||||
|
||||
pipeline = PaddleOCRVL(
|
||||
pipeline_version="v1.6",
|
||||
vl_rec_backend="vllm-server",
|
||||
vl_rec_server_url="http://localhost:8000/v1",
|
||||
vl_rec_api_model_name="PaddlePaddle/PaddleOCR-VL-1.6",
|
||||
)
|
||||
|
||||
output = pipeline.predict("https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/paddleocr_vl_demo.png")
|
||||
for i, res in enumerate(output):
|
||||
res.save_to_json(save_path=f"output_{i}.json")
|
||||
res.save_to_markdown(save_path=f"output_{i}.md")
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
- [PaddleOCR-VL-1.6 on Hugging Face](https://huggingface.co/PaddlePaddle/PaddleOCR-VL-1.6)
|
||||
- [Technical report (arXiv)](https://arxiv.org/pdf/2606.03264)
|
||||
- [PaddleOCR GitHub](https://github.com/PaddlePaddle/PaddleOCR)
|
||||
- [vLLM support PR](https://github.com/vllm-project/vllm/pull/27758)
|
||||
@@ -0,0 +1,190 @@
|
||||
meta:
|
||||
title: "PaddleOCR-VL"
|
||||
slug: "paddleocr-vl"
|
||||
provider: "PaddlePaddle"
|
||||
description: "PaddleOCR-VL (0.9B) — compact vision-language model for document parsing, OCR, tables, formulas, charts"
|
||||
date_added: 2025-11-04
|
||||
date_updated: 2026-04-17
|
||||
tasks:
|
||||
- multimodal
|
||||
related_recipes: []
|
||||
|
||||
model:
|
||||
model_id: "PaddlePaddle/PaddleOCR-VL"
|
||||
min_vllm_version: "0.11.1"
|
||||
architecture: dense
|
||||
parameter_count: "0.9B"
|
||||
active_parameters: "0.9B"
|
||||
context_length: 131072
|
||||
base_args:
|
||||
- "--trust-remote-code"
|
||||
- "--max-num-batched-tokens"
|
||||
- "16384"
|
||||
- "--no-enable-prefix-caching"
|
||||
- "--mm-processor-cache-gb"
|
||||
- "0"
|
||||
base_env: {}
|
||||
|
||||
dependencies:
|
||||
- note: "PaddlePaddle runtime (install in a separate venv from vllm to avoid conflicts)"
|
||||
command: "uv pip install paddlepaddle-gpu==3.2.1 --extra-index-url https://www.paddlepaddle.org.cn/packages/stable/cu126/"
|
||||
- note: "PaddleOCR document-parsing helpers"
|
||||
command: 'uv pip install -U "paddleocr[doc-parser]"'
|
||||
- note: "Safetensors loader used by the doc-parser path"
|
||||
command: "uv pip install safetensors"
|
||||
|
||||
features:
|
||||
text_only:
|
||||
description: "Skip loading the vision encoder for text-only workloads — frees VRAM for KV cache. Mutually exclusive with encoder_parallel."
|
||||
args:
|
||||
- "--language-model-only"
|
||||
encoder_parallel:
|
||||
description: "Run the vision encoder in data-parallel mode — avoids TP comm overhead on the small encoder. Mutually exclusive with text_only."
|
||||
args:
|
||||
- "--mm-encoder-tp-mode"
|
||||
- "data"
|
||||
|
||||
opt_in_features:
|
||||
- text_only
|
||||
- encoder_parallel
|
||||
|
||||
variants:
|
||||
default:
|
||||
precision: bf16
|
||||
vram_minimum_gb: 2
|
||||
description: "BF16 weights — small footprint, runs on most GPUs"
|
||||
|
||||
compatible_strategies:
|
||||
- single_node_tp
|
||||
- multi_node_tp
|
||||
|
||||
kv_offload_support:
|
||||
offloading_cpu: verified
|
||||
offloading_fs: verified
|
||||
|
||||
hardware_overrides:
|
||||
amd:
|
||||
extra_args: []
|
||||
extra_env:
|
||||
SAFETENSORS_FAST_GPU: "1"
|
||||
strategy_overrides: {}
|
||||
|
||||
guide: |
|
||||
## Overview
|
||||
|
||||
[PaddleOCR-VL](https://huggingface.co/PaddlePaddle/PaddleOCR-VL) is a SOTA resource-efficient
|
||||
model for document parsing. Its core (PaddleOCR-VL-0.9B) combines a NaViT-style dynamic
|
||||
resolution visual encoder with an ERNIE-4.5-0.3B language model, optimized for OCR,
|
||||
tables, formulas, and chart recognition.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Hardware: 1x GPU (small VRAM footprint)
|
||||
- vLLM >= 0.11.1 (nightly if not released yet)
|
||||
- AMD ROCm wheels require Python 3.12, ROCm 7.2.3, and glibc >= 2.35.
|
||||
|
||||
### Install vLLM (NVIDIA)
|
||||
|
||||
```bash
|
||||
uv venv
|
||||
source .venv/bin/activate
|
||||
uv pip install -U vllm --pre \
|
||||
--extra-index-url https://wheels.vllm.ai/nightly \
|
||||
--extra-index-url https://download.pytorch.org/whl/cu129 \
|
||||
--index-strategy unsafe-best-match
|
||||
```
|
||||
|
||||
### Install vLLM (AMD ROCm)
|
||||
|
||||
```bash
|
||||
uv venv --python 3.12
|
||||
source .venv/bin/activate
|
||||
uv pip install vllm --extra-index-url https://wheels.vllm.ai/rocm
|
||||
```
|
||||
|
||||
## Launch command
|
||||
|
||||
```bash
|
||||
vllm serve PaddlePaddle/PaddleOCR-VL \
|
||||
--trust-remote-code \
|
||||
--max-num-batched-tokens 16384 \
|
||||
--no-enable-prefix-caching \
|
||||
--mm-processor-cache-gb 0
|
||||
```
|
||||
|
||||
AMD MI300X/MI325X/MI355X:
|
||||
|
||||
```bash
|
||||
export SAFETENSORS_FAST_GPU=1
|
||||
|
||||
vllm serve PaddlePaddle/PaddleOCR-VL \
|
||||
--trust-remote-code \
|
||||
--max-num-batched-tokens 16384 \
|
||||
--no-enable-prefix-caching \
|
||||
--mm-processor-cache-gb 0
|
||||
```
|
||||
|
||||
Tip: OCR workloads don't benefit much from prefix caching or image reuse, so disable
|
||||
those to avoid hashing/caching overhead.
|
||||
|
||||
## Client Usage
|
||||
|
||||
Task-specific prompts:
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1", timeout=3600)
|
||||
|
||||
TASKS = {
|
||||
"ocr": "OCR:",
|
||||
"table": "Table Recognition:",
|
||||
"formula": "Formula Recognition:",
|
||||
"chart": "Chart Recognition:",
|
||||
}
|
||||
|
||||
response = client.chat.completions.create(
|
||||
model="PaddlePaddle/PaddleOCR-VL",
|
||||
messages=[{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "image_url", "image_url": {"url": "https://.../receipt.png"}},
|
||||
{"type": "text", "text": TASKS["ocr"]},
|
||||
],
|
||||
}],
|
||||
temperature=0.0,
|
||||
)
|
||||
print(response.choices[0].message.content)
|
||||
```
|
||||
|
||||
## Offline Inference with PP-DocLayoutV2
|
||||
|
||||
Use separate venvs for `vllm` and `paddlepaddle` to avoid conflicts. If you see
|
||||
"The model PaddleOCR-VL-0.9B does not exist.", add `--served-model-name PaddleOCR-VL-0.9B`.
|
||||
|
||||
```bash
|
||||
uv pip install paddlepaddle-gpu==3.2.1 --extra-index-url https://www.paddlepaddle.org.cn/packages/stable/cu126/
|
||||
uv pip install -U "paddleocr[doc-parser]"
|
||||
uv pip install safetensors
|
||||
```
|
||||
|
||||
```python
|
||||
from paddleocr import PaddleOCRVL
|
||||
|
||||
pipeline = PaddleOCRVL(
|
||||
vl_rec_backend="vllm-server",
|
||||
vl_rec_server_url="http://localhost:8000/v1",
|
||||
layout_detection_model_name="PP-DocLayoutV2",
|
||||
layout_detection_model_dir="/path/to/your/PP-DocLayoutV2/",
|
||||
)
|
||||
|
||||
output = pipeline.predict("https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/paddleocr_vl_demo.png")
|
||||
for i, res in enumerate(output):
|
||||
res.save_to_json(save_path=f"output_{i}.json")
|
||||
res.save_to_markdown(save_path=f"output_{i}.md")
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
- [PaddleOCR-VL on Hugging Face](https://huggingface.co/PaddlePaddle/PaddleOCR-VL)
|
||||
- [PaddleOCR GitHub](https://github.com/PaddlePaddle/PaddleOCR)
|
||||
Reference in New Issue
Block a user