special_tokens_mask value was unused and calculated twice
Author: guillaume-be
Pull request: yes

In the current master, in the `prepare_for_model` method of the `PreTrainedTokenizer` class, the sepcial_tokens_mask is calculated but not used: https://github.com/huggingface/transformers/blob/5bfcd0485ece086ebcbed2d008813037968a9e58/transformers/tokenization_utils.py#L904. 

```python
        # Handle special_tokens
        if add_special_tokens:
            sequence = self.build_inputs_with_special_tokens(ids, pair_ids)
            token_type_ids = self.create_token_type_ids_from_sequences(ids, pair_ids)
            special_tokens_mask = self.get_special_tokens_mask(ids, pair_ids)
        else:
            sequence = ids + pair_ids if pair else ids
            token_type_ids = [0] * len(ids) + ([1] * len(pair_ids) if pair else [])
            special_tokens_mask = [0] * (len(ids) + (len(pair_ids) if pair else 0))
        if return_special_tokens_mask:
            encoded_inputs["special_tokens_mask"] = self.get_special_tokens_mask(ids, pair_ids)
```

The proposed change is to use the `special_tokens_mask ` computed in the if/else statement in the output dictionary.

Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/2063?src=pr&el=h1) Report
> Merging [#2063](https://codecov.io/gh/huggingface/transformers/pull/2063?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/fb0d2f1da102d699c6457fd98be35f89852d08b9?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/transformers/pull/2063/graphs/tree.svg?width=650&token=9qOlN6Hb1c&height=150&src=pr)](https://codecov.io/gh/huggingface/transformers/pull/2063?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #2063   +/-   ##
=======================================
  Coverage   83.58%   83.58%           
=======================================
  Files         105      105           
  Lines       15568    15568           
=======================================
  Hits        13012    13012           
  Misses       2556     2556
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/2063?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [transformers/tokenization\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/2063/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL3Rva2VuaXphdGlvbl91dGlscy5weQ==) | `91.87% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/2063?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huggingface/transformers/pull/2063?src=pr&el=footer). Last update [fb0d2f1...7f998b1](https://codecov.io/gh/huggingface/transformers/pull/2063?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Thanks for catching it!

@LysandreJik do we want to have `special_tokens_mask` returned as a tensor when `encode` is called with `return_tensors='pt' or 'tf'`. I would say no.

Thanks for that @guillaume-be, we can merge.

@thomwolf I don't really see a use-case where having it as a tensor would be useful. I believe its main use is be for pre-processing, maybe it would be useful to have it as a tensor then but I'm not convinced.

Ok, great! merging