[pipelines] Update fill mask pipeline to remove special tokens in the output
Author: thomwolf
Pull request: yes
Labels: name: wontfix

Small fix to remove the special tokens from the output of the fill mask pipeline.

Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/5681?src=pr&el=h1) Report
> Merging [#5681](https://codecov.io/gh/huggingface/transformers/pull/5681?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/7fad617dc1fc681a7f5da5e0172c8b83f4bf0024&el=desc) will **decrease** coverage by `0.20%`.
> The diff coverage is `100.00%`.

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

```diff
@@            Coverage Diff             @@
##           master    #5681      +/-   ##
==========================================
- Coverage   78.11%   77.91%   -0.21%     
==========================================
  Files         146      146              
  Lines       25983    25983              
==========================================
- Hits        20297    20244      -53     
- Misses       5686     5739      +53     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/5681?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/pipelines.py](https://codecov.io/gh/huggingface/transformers/pull/5681/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9waXBlbGluZXMucHk=) | `76.36% <100.00%> (ø)` | |
| [src/transformers/modeling\_tf\_t5.py](https://codecov.io/gh/huggingface/transformers/pull/5681/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl90NS5weQ==) | `44.56% <0.00%> (-46.35%)` | :arrow_down: |
| [src/transformers/modeling\_tf\_gpt2.py](https://codecov.io/gh/huggingface/transformers/pull/5681/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9ncHQyLnB5) | `63.55% <0.00%> (-31.78%)` | :arrow_down: |
| [src/transformers/generation\_tf\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/5681/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9nZW5lcmF0aW9uX3RmX3V0aWxzLnB5) | `79.44% <0.00%> (-6.52%)` | :arrow_down: |
| [src/transformers/modeling\_tf\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/5681/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl91dGlscy5weQ==) | `86.92% <0.00%> (-1.97%)` | :arrow_down: |
| [src/transformers/modeling\_openai.py](https://codecov.io/gh/huggingface/transformers/pull/5681/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19vcGVuYWkucHk=) | `82.31% <0.00%> (+1.28%)` | :arrow_up: |
| [src/transformers/modeling\_tf\_roberta.py](https://codecov.io/gh/huggingface/transformers/pull/5681/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9yb2JlcnRhLnB5) | `93.36% <0.00%> (+49.37%)` | :arrow_up: |
| [src/transformers/modeling\_tf\_openai.py](https://codecov.io/gh/huggingface/transformers/pull/5681/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9vcGVuYWkucHk=) | `95.18% <0.00%> (+74.91%)` | :arrow_up: |

------

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


Hi Thomas, I found the output is something like this with the latest version of `transformers`:
```json
[
  {
    "sequence": "
if (x is not None) and(x>1)
",
    "score": 0.7236990928649902,
    "token": 8,
    "token_str": "Ġand"
  },
  {
    "sequence": "
if (x is not None) &(x>1)
",
    "score": 0.10633797943592072,
    "token": 359,
    "token_str": "Ġ&"
  },
  {
    "sequence": "
if (x is not None)and(x>1)
",
    "score": 0.021604137495160103,
    "token": 463,
    "token_str": "and"
  },
  {
    "sequence": "
if (x is not None) AND(x>1)
",
    "score": 0.02122747339308262,
    "token": 4248,
    "token_str": "ĠAND"
  },
  {
    "sequence": "
if (x is not None) if(x>1)
",
    "score": 0.016991324722766876,
    "token": 114,
    "token_str": "Ġif"
  }
]
```

However, when using `2.9.1`, I get:
```python
{'sequence': '
 if (x is not None) and (x>1)
', 'score': 0.6049249172210693, 'token': 8}
{'sequence': '
 if (x is not None) or (x>1)
', 'score': 0.30680200457572937, 'token': 50}
{'sequence': '
 if (x is not None) if (x>1)
', 'score': 0.02133703976869583, 'token': 114}
{'sequence': '
 if (x is not None) then (x>1)
', 'score': 0.018607674166560173, 'token': 172}
{'sequence': '
 if (x is not None) AND (x>1)
', 'score': 0.007619690150022507, 'token': 4248}
```

The output sequence of `2.9.1` is way much cleaner. Can this PR fix this?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.