alt.freeweights.vision / pix2struct-textcaps-base
From: google <huggingface.co/google>Newsgroups: alt.freeweights.visionSubject:

pix2struct-textcaps-base

Date: 2026-11-14Commit: 61bee0dSigned: 2DC28CC7B26A283B ✓

Image to text model with 282M parameters. Safetensors weights, 2.26 GB in all. Published by google under Apache-2.0.

282M params2.26GBpix2struct-textcaps-basesafetensorspermissive
FactsParams282MSize2.26 GBFormatssafetensorsTaskimage to textLicenseApache-2.0From sourcepermissive
$ fw get google/pix2struct-textcaps-base
# manifest sha256 996aea5f0894… · 2.26 GB · 10 files
$ fw verify ./pix2struct-textcaps-base google/pix2struct-textcaps-base
From sourceHosted (signed)google/pix2struct-textcaps-baseLast check: 2026-11-14 21:36 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Works with

Runs with

Ranked by fit to this model (safetensors), then by GitHub stars.

Overview

Size
2.26 GB
Weights
1.13 GB (safetensors)
Parameters
282M
Formats
safetensors
Task
image to text
License
Apache-2.0 (permissive)
Files
10, each with a sha256
Publisher
google
Added
2026-11-14
Section
alt.freeweights.vision
Lineage

Original release from the publisher.

Where these bytes come from
Publisher at the pinned commit→You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-14 21:36 UTCpassed

Model card

From the publisher at commit 61bee0d. Shown as plain text with links; images open at the publisher.

Model card for Pix2Struct - Finetuned on TextCaps#

Image: model_image

Table of Contents#

  1. TL;DR
  2. Using the model
  3. Contribution
  4. Citation

TL;DR#

Pix2Struct is an image encoder - text decoder model that is trained on image-text pairs for various tasks, including image captionning and visual question answering. The full list of available models can be found on the Table 1 of the paper:

Image: Table 1 - paper

The abstract of the model states that:

Visually-situated language is ubiquitous—sources range from textbooks with diagrams to web pages with images and tables, to mobile apps with buttons and

forms. Perhaps due to this diversity, previous work has typically relied on domainspecific recipes with limited sharing of the underlying data, model architectures, and objectives. We present Pix2Struct, a pretrained image-to-text model for purely visual language understanding, which can be finetuned on tasks containing visually-situated language. Pix2Struct is pretrained by learning to parse masked screenshots of web pages into simplified HTML. The web, with its richness of visual elements cleanly reflected in the HTML structure, provides a large source of pretraining data well suited to the diversity of downstream tasks. Intuitively, this objective subsumes common pretraining signals such as OCR, language modeling, image captioning. In addition to the novel pretraining strategy, we introduce a variable-resolution input representation and a more flexible integration of language and vision inputs, where language prompts such as questions are rendered directly on top of the input image. For the first time, we show that a single pretrained model can achieve state-of-the-art results in six out of nine tasks across four domains: documents, illustrations, user interfaces, and natural images.

Using the model#

Converting from T5x to huggingface#

You can use the convert_pix2struct_checkpoint_to_pytorch.py script as follows:

python convert_pix2struct_checkpoint_to_pytorch.py --t5x_checkpoint_path PATH_TO_T5X_CHECKPOINTS --pytorch_dump_path PATH_TO_SAVE

if you are converting a large model, run:

python convert_pix2struct_checkpoint_to_pytorch.py --t5x_checkpoint_path PATH_TO_T5X_CHECKPOINTS --pytorch_dump_path PATH_TO_SAVE --use-large

Once saved, you can push your converted model with the following snippet:

from transformers import Pix2StructForConditionalGeneration, Pix2StructProcessor

model = Pix2StructForConditionalGeneration.from_pretrained(PATH_TO_SAVE)
processor = Pix2StructProcessor.from_pretrained(PATH_TO_SAVE)

model.push_to_hub("USERNAME/MODEL_NAME")
processor.push_to_hub("USERNAME/MODEL_NAME")

Running the model#

In full precision, on CPU:#

You can run the model in full precision on CPU:

import requests
from PIL import Image
from transformers import Pix2StructForConditionalGeneration, Pix2StructProcessor

url = "https://www.ilankelman.org/stopsigns/australia.jpg"
image = Image.open(requests.get(url, stream=True).raw)

model = Pix2StructForConditionalGeneration.from_pretrained("google/pix2struct-textcaps-base")
processor = Pix2StructProcessor.from_pretrained("google/pix2struct-textcaps-base")

# image only
inputs = processor(images=image, return_tensors="pt")

predictions = model.generate(**inputs)
print(processor.decode(predictions[0], skip_special_tokens=True))
>>> A stop sign is on a street corner.
In full precision, on GPU:#

You can run the model in full precision on CPU:

import requests
from PIL import Image
from transformers import Pix2StructForConditionalGeneration, Pix2StructProcessor

url = "https://www.ilankelman.org/stopsigns/australia.jpg"
image = Image.open(requests.get(url, stream=True).raw)

model = Pix2StructForConditionalGeneration.from_pretrained("google/pix2struct-textcaps-base").to("cuda")
processor = Pix2StructProcessor.from_pretrained("google/pix2struct-textcaps-base")

# image only
inputs = processor(images=image, return_tensors="pt").to("cuda")

predictions = model.generate(**inputs)
print(processor.decode(predictions[0], skip_special_tokens=True))
>>> A stop sign is on a street corner.
In half precision, on GPU:#

You can run the model in full precision on CPU:

import requests
import torch

from PIL import Image
from transformers import Pix2StructForConditionalGeneration, Pix2StructProcessor

url = "https://www.ilankelman.org/stopsigns/australia.jpg"
image = Image.open(requests.get(url, stream=True).raw)

model = Pix2StructForConditionalGeneration.from_pretrained("google/pix2struct-textcaps-base", torch_dtype=torch.bfloat16).to("cuda")
processor = Pix2StructProcessor.from_pretrained("google/pix2struct-textcaps-base")

# image only
inputs = processor(images=image, return_tensors="pt").to("cuda", torch.bfloat16)

predictions = model.generate(**inputs)
print(processor.decode(predictions[0], skip_special_tokens=True))
>>> A stop sign is on a street corner.
Use different sequence length#

This model has been trained on a sequence length of 2048. You can try to reduce the sequence length for a more memory efficient inference but you may observe some performance degradation for small sequence length (<512). Just pass max_patches when calling the processor:

inputs = processor(images=image, return_tensors="pt", max_patches=512)
Conditional generation#

You can also pre-pend some input text to perform conditional generation:

import requests
from PIL import Image
from transformers import Pix2StructForConditionalGeneration, Pix2StructProcessor

url = "https://www.ilankelman.org/stopsigns/australia.jpg"
image = Image.open(requests.get(url, stream=True).raw)
text = "A picture of"

model = Pix2StructForConditionalGeneration.from_pretrained("google/pix2struct-textcaps-base")
processor = Pix2StructProcessor.from_pretrained("google/pix2struct-textcaps-base")

# image only
inputs = processor(images=image, text=text, return_tensors="pt")

predictions = model.generate(**inputs)
print(processor.decode(predictions[0], skip_special_tokens=True))
>>> A picture of a stop sign that says yes.

Contribution#

This model was originally contributed by Kenton Lee, Mandar Joshi et al. and added to the Hugging Face ecosystem by Younes Belkada.

Citation#

If you want to cite this work, please consider citing the original paper:

@misc{https://doi.org/10.48550/arxiv.2210.03347,
  doi = {10.48550/ARXIV.2210.03347},
  
  url = {https://arxiv.org/abs/2210.03347},
  
  author = {Lee, Kenton and Joshi, Mandar and Turc, Iulia and Hu, Hexiang and Liu, Fangyu and Eisenschlos, Julian and Khandelwal, Urvashi and Shaw, Peter and Chang, Ming-Wei and Toutanova, Kristina},
  
  keywords = {Computation and Language (cs.CL), Computer Vision and Pattern Recognition (cs.CV), FOS: Computer and information sciences, FOS: Computer and information sciences},
  
  title = {Pix2Struct: Screenshot Parsing as Pretraining for Visual Language Understanding},
  
  publisher = {arXiv},
  
  year = {2022},
  
  copyright = {Creative Commons Attribution 4.0 International}
}

Files

10 files · 2.26 GBWeights 1.13 GB (safetensors). Sizes and sha256 from the signed manifest.
Hide all 10 files with their sha256
FileSizesha256
.gitattributes1.48 KBdb7c0371f46f0840b8f25794c1e3321c9b5820a8cb6ba9694a46fc64b8fae5a6
README.md7.68 KBe5dc83622c2ce6ce1df491db93f6ddc6a7ac27f5988c4a36c432a69e91de0bf0
config.json5.01 KBaaebb1cbc1eb952676e1b874b09ea28b2519f654ebf261807b22eaebc43f2023
model.safetensors1.13 GB771693f7e310a89d77aa7ee4d1f5ea3e0c4adb0b6112cdf25a20da29cc3d0ea7
preprocessor_config.json217 B885e6dd8946290a61b0a808e90cc74dd1a33a011b6482fd213bc7327945305f8
pytorch_model.bin1.13 GB2e8599e7e8a6912e1654d2aff5a158ffed8814da8742090a229cc08ba35cde2c
special_tokens_map.json2.20 KB5c87151ef0f72a99d1f766a4c418bd2a1f90aaa30a8e22fe5eca9641daebb64f
spiece.model851 KB7fd650335add59bed55a432186ca0437a09e185c2d241faab468a538fe6bcf94
tokenizer.json3.27 MB0af109b23840545ef2c286073f4373959badba1faa73c8557881d5126f6287c9
tokenizer_config.json2.58 KB5fdb6767a49aca48fdfa43d0279321918185fc4997bdb3ea72bf3a6301a1b43d
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
61bee0d7e2 pinned now manifest updated, same commit2026-11-14 21:36 UTC10 files · 2.26 GB
61bee0d7e22026-11-14 21:36 UTC10 files · 2.26 GB

Use it

$ fw get google/pix2struct-textcaps-base
# manifest sha256 996aea5f0894… · 2.26 GB · 10 files
$ fw verify ./pix2struct-textcaps-base google/pix2struct-textcaps-base
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/google/pix2struct-textcaps-base.json --dir ./pix2struct-textcaps-base $ python3 fw.py verify ./pix2struct-textcaps-base ./google__pix2struct-textcaps-base.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download google/pix2struct-textcaps-base --revision 61bee0d7e2378e601b68f853ceee4f7cf99f1b88 --local-dir ./pix2struct-textcaps-base

License

Name
Apache License 2.0
Id
Apache-2.0
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-14
Text in
README.md
Text sha256
e5dc83622c2ce6ce1df491db93f6ddc6a7ac27f5988c4a36c432a69e91de0bf0
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: google <huggingface.co/google>Newsgroups: alt.freeweights.visionSubject: pix2struct-textcaps-baseDate: 2026-11-14Commit: 61bee0dSigned: 2DC28CC7B26A283B ✓
Upstream
google/pix2struct-textcaps-base
Pinned commit
61bee0d7e2378e601b68f853ceee4f7cf99f1b88
Manifest
pix2struct-textcaps-base.json · .minisig
Manifest sha256
996aea5f0894b934a1d58a0a233f8edb5e41eeaf4184e8b048e677931e21d42b
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-14 21:36 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/google/pix2struct-textcaps-base.json $ curl -O https://freeweights.allternit.com/manifests/google/pix2struct-textcaps-base.json.minisig $ minisign -Vm pix2struct-textcaps-base.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

No related models in this catalog.Nothing here lists this model as its parent, and it names no parent.
Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download google/pix2struct-textcaps-base
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. pix2struct-textcaps-base.json. Provenance. Takedown history: none.
From: dima806 <huggingface.co/dima806>Subject: ai_vs_real_image_detection
From: legekka <huggingface.co/legekka>Subject: AI-Anime-Image-Detector-ViT
From: onnx-community <huggingface.co/onnx-community>Subject: AI-Anime-Image-Detector-ViT-ONNX
From: AICodexLab <huggingface.co/AICodexLab>Subject: answerdotai-ModernBERT-base-ai-detector
From: onnx-community <huggingface.co/onnx-community>Subject: answerdotai-ModernBERT-base-ai-detector-ONNX
From: onnx-community <huggingface.co/onnx-community>Subject: bart-large-cnn-ONNX