LayoutLM Tensorflow model
# 🚀 Feature request

It would be great if there was a TF version of the layoutlm. I see there are scripts in the repo to convert PyTorch checkpoints to TF models but I think the requirement is to have a TF model architecture to be able to load PyTorch model's wights in it.

## Motivation
We are using TF in production and we'd love to be able to use the layoutlm.

## Your contribution
I am happy to tackle the conversion. 

I was wondering if there are instructions on how to do the conversion properly so that it can be added to the repo. 

Sure, I can guide you if you want.

As LayoutLM is only a slight adaptation from BERT, I guess you can define `modeling_tf_layoutlm.py` based on `modeling_tf_bert.py`.  Note that all layers should be renamed, e.g. `TFBertEmbeddings` -> `TFLayoutLMEmbeddings`. LayoutLM adds position embeddings for the tokens based on the bounding boxes, so I guess this is the only thing that needs to be added in the [embedding layer](https://github.com/huggingface/transformers/blob/88605f37a6fe7bde336f52700229d619b5ffa0f6/src/transformers/models/bert/modeling_tf_bert.py#L131). 

In PyTorch, we have:
https://github.com/huggingface/transformers/blob/88605f37a6fe7bde336f52700229d619b5ffa0f6/src/transformers/models/layoutlm/modeling_layoutlm.py#L65-L68

So this will need to be added to the `TFLayoutLMEmbeddings` class. Regarding a conversion script to convert the PyTorch weights into the TF version, there's a general script to convert PyTorch weights to TF 2 models: https://github.com/huggingface/transformers/blob/master/src/transformers/convert_pytorch_checkpoint_to_tf2.py

This works if all weights names are identical between the PT and TF implementations.<|||||>@NielsRogge Thanks for the guidance, I think I know where to start. 
I'll comment here if I had more questions. I am hoping to have a PR by the end of this week <|||||>Should I upload TF weights under `https://huggingface.co/microsoft/` in the same place PT weights are stored?<|||||>Yes, pinging @julien-c here to give you access<|||||>pinging @LysandreJik and @sgugger <|||||>We don't have granular write access to model repos so (unless you're affiliated with Microsoft in some way) I would suggest you upload the files to a model repo under your HF user account and then we (or them) can copy the relevant files to the main repos!

Let me know if this is a suitable workflow.<|||||>@julien-c Thanks, the suggested workflow sounds good.<|||||>closing this issue as the code is already merged.