PaddleOCR-VL-1.6 Vietnamese Merged

Full BF16 model produced by merging the Vietnamese LoRA adapter into PaddlePaddle/PaddleOCR-VL-1.6. This repository is standalone; the LoRA adapter is not required at inference time.

Use the exact user prompt OCR: and preserve the included native multimodal chat template.

Loading and inference

The verified environment used Python 3.12, PyTorch 2.11.0+cu128, Transformers 4.55.4, and a CUDA GPU.

import os

os.environ.setdefault("CUBLAS_WORKSPACE_CONFIG", ":4096:8")

import torch
from PIL import Image
from transformers import AutoModelForCausalLM, AutoProcessor

model_id = "tieubaoca/PaddleOCR-VL-1.6-Vietnamese-Merged"
processor = AutoProcessor.from_pretrained(
    model_id,
    trust_remote_code=True,
    use_fast=False,
)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    trust_remote_code=True,
    torch_dtype=torch.bfloat16,
    attn_implementation="eager",
).to("cuda").eval()

messages = [
    {
        "role": "user",
        "content": [
            {"type": "image", "image": "document.png"},
            {"type": "text", "text": "OCR:"},
        ],
    }
]
prompt = processor.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
)
with Image.open("document.png") as source:
    image = source.convert("RGB").copy()
inputs = processor(text=[prompt], images=[image], return_tensors="pt")
inputs = {name: value.to("cuda") for name, value in inputs.items()}
prompt_length = inputs["input_ids"].shape[1]

with torch.inference_mode():
    generated_ids = model.generate(
        **inputs,
        do_sample=False,
        num_beams=1,
        max_new_tokens=256,
        use_cache=True,
    )
text = processor.batch_decode(
    generated_ids[:, prompt_length:],
    skip_special_tokens=True,
    clean_up_tokenization_spaces=False,
)[0].strip()
print(text)

Evaluation

Deterministic greedy decoding with the native processor and chat template, 32 fixed validation samples from each of five sources, and 256 maximum new tokens.

Model Samples CER Exact match Normalized edit distance
PaddleOCR-VL-1.6 base 160 0.234065 0.137500 0.755668
Vietnamese merged model 160 0.066029 0.512500 0.941240

Merged per-source metrics:

Source Samples CER Exact match Normalized edit distance
source-000 32 0.091364 0.062500 0.910921
source-001 32 0.096000 0.781250 0.910813
source-002 32 0.070355 0.312500 0.932029
source-003 32 0.044308 0.718750 0.964717
source-004 32 0.015504 0.687500 0.987720

Merge verification

  • All 126 LoRA-targeted tensors were merged.
  • The exported weights matched the in-memory merged model after BF16 output casting within rtol=0.0005 and atol=0.0005.
  • Exported and in-memory merged logits were identical on the verification fixture (max_abs_error=0.0, equal argmax).

The original PaddleOCR-VL-1.6 license is included as LICENSE.

Downloads last month
10
Safetensors
Model size
1.0B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for tieubaoca/PaddleOCR-VL-1.6-Vietnamese-Merged

Finetuned
(8)
this model