LMV2Processor Decoder string not matching with original string
Author: purnasai
Pull request: no

## Environment info
- `transformers` version: 4.11.0
- Platform: Linux-5.4.0-1063-aws-x86_64-with-debian-buster-sid
- Python version: 3.7.10
- PyTorch version (GPU?): 1.8.0 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?[/GPU]()?[/TPU]()?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>


### Who can help
@NielsRogge @SaulLu


## Information

Model I am using LayoutLMv2:

The problem arises when using the processor to decode:
```
from transformers import LayoutLMv2Processor
from PIL import Image
import cv2

processor = LayoutLMv2Processor.from_pretrained("microsoft/layoutlmv2-base-uncased", revision="no_ocr")
large = cv2.imread('Employee_ID_2.png')
words = ["hello", "world", "10/12/2021","O +ve"]
boxes = [[1, 2, 3, 4], [5, 6, 7, 8], [1, 2, 3, 4], [5, 6, 7, 8]]  # make sure to normalize your bounding boxes
encoding = processor(large, words, boxes=boxes, return_tensors="pt",add_special_tokens = True)
print(encoding.keys())
```
dict_keys(['input_ids', 'token_type_ids', 'attention_mask', 'bbox', 'image'])
```
encoding['input_ids'].tolist()[0]
```
[101, 7592, 2088, 2184, 1013, 2260, 1013, 25682, 1051, 1009, 2310, 102]

```
processor.tokenizer.decode(encoding['input_ids'].tolist()[0],skip_special_tokens= True)
```
'hello world 10 / 12 / 2021 o + ve'

#### Issue:
Decoder splits the date and blood group which are not the same as the original text.   What changes can i make to get the desired results.
## To reproduce
Use the above code to reproduce
## Expected behavior
Decoder output should match the original text.
["hello", "world", "10/12/2021","O +ve"]

Comments:
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.

Hi,

I assume this is due to the WordPiece algorithm. cc'ing @SaulLu who knows this better than me.

Hi @purnasai,

I also agree with Niels, I think that the proposed decoding here is the best we can do. :disappointed: 

_As a reminder, the method is developed for the case of generated tokens (in other words, for the case where the initial input is not known)._ 

For context, the LayoutLMv2 tokenizer is based on the BERT tokenizer. Like all other tokenizers, the BERT tokenizer consists of a succession of several operations: normalization, pre-tokenization, application of the tokenization model and finally post-processing. Decoding is a final operation performed on the output given by the previous pipeline. 

During the pre-tokenization phase, the BERT decides, among other things, to split the initial textual input on spaces (by removing them) and also on punctuation (without removing them). It is therefore at the time of this operation that we lose information forever: were the tokens separated by a space or not? 

For example, `"this is a test 10/12/2421"` will be pre-tokenized in:
```
[('this', (0, 4)),
 ('is', (5, 7)),
 ('a', (8, 9)),
 ('test', (10, 14)),
 ('10', (15, 17)),
 ('/', (17, 18)),
 ('12', (18, 20)),
 ('/', (20, 21)),
 ('2421', (21, 25))]
 ```

The Worpiece tokenization algorithm will then be applied to this pre-tokenized input, resulting in: `['this', 'is', 'a', 'test', '10', '/', '12', '/', '242', '##1']`.  To do the best, at the time of decoding we add a space between each pair of tokens if the 2nd token of the pair does not start with "##". 

I hope this explanation was helpful for you!

Could you share with us for which use case you want to use the decode method? :blush: 

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.