

Inference
TrOCR's [VisionEncoderDecoder] model accepts images as input and makes use of
[~generation.GenerationMixin.generate] to autoregressively generate text given the input image.
The [ViTImageProcessor/DeiTImageProcessor] class is responsible for preprocessing the input image and
[RobertaTokenizer/XLMRobertaTokenizer] decodes the generated target tokens to the target string. The
[TrOCRProcessor] wraps [ViTImageProcessor/DeiTImageProcessor] and [RobertaTokenizer/XLMRobertaTokenizer]
into a single instance to both extract the input features and decode the predicted token ids.