  pre-training (while LayoutLMv1 only adds visual embeddings during fine-tuning).
LayoutLMv2 adds both a relative 1D attention bias as well as a spatial 2D attention bias to the attention scores in
  the self-attention layers. Details can be found on page 5 of the paper.
Demo notebooks on how to use the LayoutLMv2 model on RVL-CDIP, FUNSD, DocVQA, CORD can be found here.
LayoutLMv2 uses Facebook AI's Detectron2 package for its visual
  backbone. See this link for installation
  instructions.
In addition to input_ids, [~LayoutLMv2Model.forward] expects 2 additional inputs, namely
  image and bbox. The image input corresponds to the original document image in which the text
  tokens occur. The model expects each document image to be of size 224x224. This means that if you have a batch of
  document images, image should be a tensor of shape (batch_size, 3, 224, 224). This can be either a
