
OCR-free document understanding with a Donut model: reads one document Image end-to-end and emits a downstream-resolved oneof t[String, [(String, String)]] — either the raw decoded sequence as text, or the structured parse flattened to dotted key/value pairs.
Receipt or form image fetched over HTTP, parsed into structured fields, and returned as JSON for a downstream service to consume.
A rendered PDF page is cropped to the region of interest before parsing so the model only sees the document body, not surrounding margins.
String arm emits the raw decoded sequence, while the [(String, String)] arm emits the parse flattened to dotted key/value pairs whose key set is determined by the checkpoint, not a fixed schema.model and task_prompt must come from the same fine-tuned head — the decoder start token selects which parser runs, and a mismatch still produces text but the content is meaningless, with no error raised.max_length caps the decoded sequence; documents with many fields can be silently truncated at the tail, so raise it when the end of a long parse is missing.device requesting a GPU on a host without one falls back to CPU, where per-page latency climbs sharply.Automated release