Run LayoutXLM without image input not possible
Author: RitaDS
Pull request: no

## Environment info
- `transformers` version: 4.15.0
- Platform: 
- Python version: 3.6.9
- PyTorch version (GPU?): 1.8
- Tensorflow version (GPU?): 1.14.0
- Using GPU in script?: yes
- Using distributed or parallel set-up in script?: no

### Who can help
@NielsRogge


## Information

Model I am using (Bert, XLNet ...): LayoutXLM

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [x] my own modified scripts: (give details below)

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [x] my own task or dataset: (give details below)

## To reproduce
import_tokennizer='microsoft/layoutxlm-base'
tokenizer = LayoutXLMTokenizer.from_pretrained(import_tokennizer)
model = LayoutLMv2Model.from_pretrained(import_tokennizer, output_attentions = True)
model.to(device)

encoding = tokenizer(['Image Problem'],boxes=[[56,78,102,89]], padding='max_length', add_special_tokens = True, truncation=True, return_tensors="pt", max_length=512, return_attention_mask = True, return_token_type_ids=True)

outputs = model(input_ids=encoding.input_ids.to(device), 
                bbox=encoding.bbox.to(device), 
                attention_mask=encoding.attention_mask.to(device), 
                token_type_ids=encoding.token_type_ids.to(device))

## Error messages
![image](https://user-images.githubusercontent.com/50209817/151368023-85a4f889-9af5-463f-bd47-9322cd855685.png)

## Expected behavior
I would expect to be able to use LayoutXLM without image input, but I can't make it work. I think it is related with the fact that there is no "if image is None" as there is for other inputs in the forward function. 
And in that way, when I do not pass image as input and the execution gets here:
![image](https://user-images.githubusercontent.com/50209817/151378172-271b4515-e978-4cb9-8b0e-8ed281664289.png)
in the forward function, it throughs an error. I believe this makes it impossible to use the model without the image input. I am right? If I am, weren't we supose to?

Thank you. 


Comments:
Hi,

LayoutXLM, like LayoutLMv2, expects the `image` as input. Internally, LayoutLMv2 (and LayoutXLM) will forward the `image` through their visual backbone, which will serve as additional features in order to make predictions.

The `image` is a required input.

Hi, thank you for the reply. Should I close the issue ?

Yes. Wondering why you want to use the model without `image` input?

I wanted to try a simpler approach first. I am working with PDF files, and already have words and their coordinates, but to have the images it would imply for me to create one img for each pdf page and that would lead to a great increase in space. 
I had tried something similar, but I think it was with LayoutLM where I used no image, and I think I got confused. My first though was to test the impact of the relative positions, without considering the image yet.

Note that in any case, you can fork the library and tweak the code to your liking (i.e. tweak `modeling_layoutlmv2.py`). 

You can also leverage [LayoutLM](https://huggingface.co/docs/transformers/model_doc/layoutlm) (v1) which does not take the image as input. Note that providing the image as input will result in a performance increase.

Thank you for the advice. Will do. 

just subclass the model, change forward pass to encode a 3x3 white pixel grid and it will work ;)