opensi·si

UltraVBert extends ModernVBert by pairing the UltraBERT text encoder with a SigLIP vision encoder for visual document understanding and retrieval. The image processor splits a…

UltraVBert

This model was contributed to Hugging Face Transformers on 2026-10-20.

UltraVBert

Overview

UltraVBert extends ModernVBert by pairing the UltraBERT text encoder with a SigLIP vision encoder for visual document understanding and retrieval. The image processor splits a page into 512-pixel tiles plus a global view. The connector merges each 4 x 4 block of vision patches into one token, so a tile becomes 64 image tokens, and RMS-normalizes them to the scale of UltraBERT's token embeddings. max_image_tiles, 27 by default, caps the tiles per page by lowering the resize edge in 512-pixel steps.

Usage example

AutoModel

import torch

from transformers import AutoModelForMaskedLM, AutoProcessor
from transformers.image_utils import load_image

processor = AutoProcessor.from_pretrained("athrael-soju/UltraVBERT")
model = AutoModelForMaskedLM.from_pretrained("athrael-soju/UltraVBERT", device_map="auto")

image = load_image(
    "https://huggingface.co/datasets/hf-internal-testing/fixtures_image_utils/resolve/main/receipt_00008.png"
)
inputs = processor(text="<image>Rounding 0 <|mask|> 50,000", images=[image], return_tensors="pt").to(model.device)

with torch.no_grad():
    logits = model(**inputs).logits

masked_index = torch.where(inputs["input_ids"] == processor.tokenizer.mask_token_id)
predicted_token_id = logits[masked_index].argmax(dim=-1)
print(processor.tokenizer.decode(predicted_token_id))

Pipeline

The fill-mask pipeline reads text only.

from transformers import pipeline

fill_mask = pipeline(task="fill-mask", model="athrael-soju/UltraVBERT", device_map="auto")
print(fill_mask("Plants create <|mask|> through a process known as photosynthesis."))

UltraVBertConfig

[[autodoc]] UltraVBertConfig

UltraVBertImageProcessor

[[autodoc]] UltraVBertImageProcessor - preprocess

UltraVBertModel

[[autodoc]] UltraVBertModel - forward

UltraVBertForMaskedLM

[[autodoc]] UltraVBertForMaskedLM - forward