SummarizationPipeline: init required task name
Author: julien-c
Pull request: yes

Otherwise, can't do:


```python
tokenizer = AutoTokenizer.from_pretrained("facebook/bart-large-cnn")
model = AutoModelWithLMHead.from_pretrained("facebook/bart-large-cnn")
p = SummarizationPipeline(model=model, tokenizer=tokenizer)

p("Long boring text to summarize, etc. etc.")
```

Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/5086?src=pr&el=h1) Report
> Merging [#5086](https://codecov.io/gh/huggingface/transformers/pull/5086?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/70bc3ead4f0b08e8cadd1805ada2a22f0c302399&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/5086/graphs/tree.svg?width=650&height=150&src=pr&token=9qOlN6Hb1c)](https://codecov.io/gh/huggingface/transformers/pull/5086?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #5086   +/-   ##
=======================================
  Coverage   77.26%   77.27%           
=======================================
  Files         133      133           
  Lines       22146    22149    +3     
=======================================
+ Hits        17111    17115    +4     
+ Misses       5035     5034    -1     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/5086?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/pipelines.py](https://codecov.io/gh/huggingface/transformers/pull/5086/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9waXBlbGluZXMucHk=) | `76.41% <100.00%> (+0.13%)` | :arrow_up: |
| [src/transformers/modeling\_tf\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/5086/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl91dGlscy5weQ==) | `87.57% <0.00%> (+0.15%)` | :arrow_up: |

------

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


I think all Pipelines have this problem, not just the `summarization` pipeline, no? 

The only time the `task` string is ever really used is in the `class Pipeline(_ScikitCompat):` to call the correct task specific config parameters. 

I would actually propose to change the `task` string logic here a bit so that we give every pipeline class a static string variable `task` and don't pass it in the init. For summarization, e.g.:

```python
class SummarizationPipeline(Pipeline):

    task = "summarization"

    def __call__(...):
         ...
```

Then in the `Pipeline` class we could have the following logic:

```python
class Pipeline:

    task = None

    def __init__(...):
         ...
         assert self.task in SUPPORTED_TASKS.values(), f"{self.task} does not exist"
```

IMO, "task" is not really part of the instantiated object, but more of the class itself. Also, I think a model should always only have one default configuration per task. I think T5 is already an exception in that it can handle multiple task and I don't really see why T5 for example would need two different default configs for summarization.  
We can always overwrite the config parameters when calling the model, so I don't think we restrict ourselves too much with this design and having multiple default configs in the config file would quickly make them unreadable.

What do you think @julien-c ?

I'm not following everything here @patrickvonplaten :)

Merging this like that for now but feel free to refine in the future