

Internally, [~transformers.LayoutLMv2Model] will send the image input through its visual backbone to
  obtain a lower-resolution feature map, whose shape is equal to the image_feature_pool_shape attribute of
  [~transformers.LayoutLMv2Config]. This feature map is then flattened to obtain a sequence of image tokens. As
  the size of the feature map is 7x7 by default, one obtains 49 image tokens. These are then concatenated with the text
  tokens, and send through the Transformer encoder. This means that the last hidden states of the model will have a
  length of 512 + 49 = 561, if you pad the text tokens up to the max length. More generally, the last hidden states
  will have a shape of seq_length + image_feature_pool_shape[0] *
  config.image_feature_pool_shape[1].
When calling [~transformers.LayoutLMv2Model.from_pretrained], a warning will be printed with a long list of
  parameter names that are not initialized. This is not a problem, as these parameters are batch normalization
  statistics, which are going to have values when fine-tuning on a custom dataset.
If you want to train the model in a distributed environment, make sure to call [synchronize_batch_norm] on the
  model in order to properly synchronize the batch normalization layers of the visual backbone.