All models

pix2struct (base screenshot to text)

Image-to-text model pretrained by parsing masked web screenshots into HTML.

Documents and OCR · 1,592 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (10 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
282.3M
Operations
1,592
Framework
PyTorch
Recurrent
No
Name in source
pix2struct:base-screenshot-to-text
License
Apache-2.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m8200
Graph hash
83456b6de7cbafa624020754be9877d83401c9c3641f5e62b6788b0d5d99b843
Skeleton hash
72829b49a86e6e7ffc98306526f17ba035ed10751278a72eecd883cf20c46861
Architecture hash
9dd32cb916bb38000fdb206370e5f5a639cafd28d535c906938af9bf7c48aac2
Diagram SHA-256
1fd4ab1ca6769c4ac39854a85d27ea7b63dee468a4079e1aa865fc80e1c2cf09
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

Pix2Struct is a pretrained image-to-text model for purely visual language understanding: it reads text where it sits in the picture, from textbook diagrams to web pages and app screens. Its pretraining task is to parse masked screenshots of web pages into simplified HTML, a signal the authors argue subsumes OCR, language modeling and captioning at once. Two design choices follow: a variable-resolution input representation, and prompts such as questions rendered directly onto the input image rather than fed as separate text.

The paper reports a single pretrained model reaching state-of-the-art results in six of nine tasks across documents, illustrations, user interfaces and natural images. The released checkpoints are fine-tuned per task, and the library advises using the one matching your task, such as the UI-captioning model for UI captioning. The traced member is Pix2StructForConditionalGeneration, the encoder-decoder that turns flattened image patches into text tokens.

Key idea. Screenshot parsing as pretraining: Pix2Struct learns visually-situated language by converting masked web screenshots into simplified HTML, with variable-resolution inputs and prompts rendered onto the image.

  • Pix2Struct
  • screenshot parsing
  • visually-situated language
  • image-to-text
  • document VQA
  • chart QA
  • UI captioning
  • visual language understanding

AI-written summary, based on the model's documentation and checked automatically against it; not reviewed by a person. Corrections welcome.