Piccolo-2B-VL

Piccolo-2B-VL is a vision-language model checkpoint with the Qwen3_5ForConditionalGeneration architecture and a vision configuration.

This release contains Safetensors weights: 1 main shard and model-frozen-mtp.safetensors. Both weight files are referenced by model.safetensors.index.json. The original model, generation, tokenizer and processor configurations and chat template are included.

Requirements

Python 3.12 or newer and a CUDA-capable GPU are required for the example below. Save this list as requirements.txt.

torch>=2.11
torchvision
transformers==5.19.0
safetensors>=0.8
pydantic>=2.0
Pillow>=11.3.0
httpx>=0.27.0
jinja2>=3.1.0
opencv-python-headless
pyclipper
causal-conv1d==1.7.0
flash-linear-attention>=0.6.0
huggingface_hub
numpy

Usage

This example uses a local models/Piccolo-9B-VL checkpoint and an invoice.png image in the current directory.

import base64
from pathlib import Path

import torch
from huggingface_hub import snapshot_download
from transformers import AutoModel, AutoProcessor

model_path = "models/Piccolo-9B-VL"
image_path = Path("invoice.png")
device = "cuda:0"

payload = {
    "state": {"image": "photo"},
    "questions": {
        "q": {
            "type": "noul",
            "instructions": "Does the image contain the word 'Invoice'?",
        },
    },
    "assets": {
        "photo": {
            "type": "image",
            "format": "png",
            "data_base64": base64.b64encode(image_path.read_bytes()).decode("ascii"),
        },
    },
}

processor = AutoProcessor.from_pretrained(model_path, trust_remote_code=True)
model = AutoModel.from_pretrained(
    model_path,
    trust_remote_code=True,
    dtype=torch.bfloat16,
    attn_implementation="sdpa",
).to(device).eval()

detector_path = snapshot_download("PaddlePaddle/PP-OCRv5_mobile_det_safetensors")
recognizer_path = snapshot_download("PaddlePaddle/en_PP-OCRv5_mobile_rec_safetensors")
ocr = processor.load_ocr(detector_path, recognizer_path, device=device)

with torch.inference_mode():
    for item in processor.encode_request(payload, ocr=ocr):
        result = model(**item.inputs.to(model.device))
        probabilities = dict(zip(item.option_keys, result.probabilities[0].tolist()))
        print(item.question_id, probabilities)
Downloads last month
78
Safetensors
Model size
2B params
Tensor type
BF16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for agentscope-ai/Piccolo-2B-VL

Quantizations
1 model

Collection including agentscope-ai/Piccolo-2B-VL