First token misses the first character in its `offsets_mapping` WHEN `add_prefix_space=True` is used
Author: ciaochiaociao
Pull request: no

## Environment info

- `transformers` version: 3.5.1
- Python version: 3.9.7
- PyTorch version (GPU?): 1.6.0 (GPU)

### Who can help
@SaulLu 

## Information

Model I am using (Bert, XLNet ...): roberta-large

## To reproduce

Steps to reproduce the behavior:

```
tokenizer = AutoTokenizer.from_pretrained('roberta-large', use_fast=True)
tokenizer("This is a sentence", return_offsets_mapping=True)['offset_mapping']
[(0, 0), **(0, 4)**, (5, 7), (8, 9), (10, 18), (0, 0)]}

tokenizer = AutoTokenizer.from_pretrained('roberta-large', use_fast=True, add_prefix_space=True)
tokenizer("This is a sentence", return_offsets_mapping=True)['offset_mapping']
[(0, 0), **(1, 4)**, (5, 7), (8, 9), (10, 18), (0, 0)]}
```

## Expected behavior
Should be [(0, 0), **(0, 4)**, (5, 7), (8, 9), (10, 18), (0, 0)]}

Comments:
Hi @ciaochiaociao ,

I've just tested you're snippet of code with the latest version of transformers (`transformers==4.17.0`) and the result correspond to what you're expecting:
```python
tokenizer = AutoTokenizer.from_pretrained('roberta-large', use_fast=True)
print(tokenizer("This is a sentence", return_offsets_mapping=True)['offset_mapping'])
# [(0, 0), **(0, 4)**, (5, 7), (8, 9), (10, 18), (0, 0)]}

tokenizer = AutoTokenizer.from_pretrained('roberta-large', use_fast=True, add_prefix_space=True)
print(tokenizer("This is a sentence", return_offsets_mapping=True)['offset_mapping'])
# [(0, 0), **(0, 4)**, (5, 7), (8, 9), (10, 18), (0, 0)]}
```

I've also tried to test with the version 3.5.1 of `transformers` but I think got this error when I tried to import AutoTokenizer -that you use in your snippet of code - from transformers:
```
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
[<ipython-input-3-939527a2a513>](https://localhost:8080/#) in <module>()
----> 1 from transformers import AutoTokenizer

2 frames
[/usr/local/lib/python3.7/dist-packages/transformers/trainer_pt_utils.py](https://localhost:8080/#) in <module>()
     38     SAVE_STATE_WARNING = ""
     39 else:
---> 40     from torch.optim.lr_scheduler import SAVE_STATE_WARNING
     41 
     42 logger = logging.get_logger(__name__)

ImportError: cannot import name 'SAVE_STATE_WARNING' from 'torch.optim.lr_scheduler' (/usr/local/lib/python3.7/dist-packages/torch/optim/lr_scheduler.py)

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
```

Let me know if upgrading to the last version of transformers work for you :smile: 


Cool. Thank you for your reply. 4.17.0 did work. 

By the way, FYI

`4.16.2` also works, while `4.14.1` does not, which shows the same results of `3.5.1`.

Yes, I think 2 PRs helped to solve this issue:

1. One in the transformers lib: https://github.com/huggingface/transformers/pull/14752. That was integrated into transformers v4.15.0
2. One in the tokenizers lib: https://github.com/huggingface/tokenizers/pull/844. That was integrated into tokenizers v0.11.0

With previous version, we might indeed have issues with offset mappings. :slightly_smiling_face: 

I'm closing this issue since this seems to be solved :smile: