Fixing tokenization of extra_id symbols in T5Tokenizer
Author: mansimov
Pull request: yes

Fixing tokenization of extra_id symbols in T5Tokenizer. Related to issue #4021  

Comments:
Awesome this looks good to me! 

@LysandreJik - I tried this fix and it does fix the issue https://github.com/huggingface/transformers/issues/4021 . To me it seems like this line was just forgotten when implementing T5 tokenizer.

# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/4353?src=pr&el=h1) Report
> Merging [#4353](https://codecov.io/gh/huggingface/transformers/pull/4353?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/94cb73c2d2efeb188b522ff352f98b15124ba9f8&el=desc) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.

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

```diff
@@           Coverage Diff           @@
##           master    #4353   +/-   ##
=======================================
  Coverage   78.21%   78.21%           
=======================================
  Files         120      120           
  Lines       20038    20039    +1     
=======================================
+ Hits        15673    15674    +1     
  Misses       4365     4365           
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/4353?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/tokenization\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/4353/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy90b2tlbml6YXRpb25fdXRpbHMucHk=) | `89.49% <100.00%> (+0.01%)` | :arrow_up: |
| [src/transformers/modeling\_tf\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/4353/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl91dGlscy5weQ==) | `92.77% <0.00%> (-0.17%)` | :arrow_down: |
| [src/transformers/modeling\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/4353/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ191dGlscy5weQ==) | `91.08% <0.00%> (+0.12%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/4353?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/4353?src=pr&el=footer). Last update [94cb73c...c9824f4](https://codecov.io/gh/huggingface/transformers/pull/4353?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Hi,

Is the below expected behavior? I am initializing the tokenizer with `tokenizer = T5Tokenizer.from_pretrained('t5-large', extra_ids=0, additional_special_tokens=special_tokens)` where special_tokens is a list like ['_self_say', '_partner_say', '_self_persona', '_partner_persona']. Despite specifying extra_ids=0 I see a lot of sentinel tokens in the outputs with negative ids. For example:

```
Input: _context _setting_name Tower _setting_desc The inside tower is made from a combination of wood and brick. It also has some metal to hold all the doors in place. _object a door _object a door _self_name pet dog _self_persona I am mans best friend and I wouldn't have it any other way. I tend to my master and never leave his side. I sleep at his feet and guard the room at night from things that go bump in the night. _option hug knight _option hit knight _history 

Response: <extra_id_-100>,<extra_id_-99> erreichen<extra_id_-98> hit knightăminterească a door<extra_id_-97>îî<extra_id_-96> a doorăm!<extra_id_-95> timpul<extra_id_-94> pentru<extra_id_-93>itățile Tower<extra_id_-92> I am Mans best friend.<extra_id_-91> doud<extra_id_-90> casă facem<extra_id_-89> a doorșteștehlen<extra_id_-88><extra_id_-87> tower is made from different materials. The outside
```