Fix docs and bad word tokens generation_utils.py
Author: ZhuBaohe
Pull request: yes

This PR fixes two issues:

1.
The codes
https://github.com/huggingface/transformers/blob/6028ed92bd9e5471e6f8a1d23cfd95a3a63018fb/src/transformers/generation_utils.py#L224-L228
throw an exception
`AssertionError: Greedy decoding will always produce the same output for num_beams == 1 and num_return_sequences > 1. Please set num_return_sequences = 1`

2.
The codes
```python
from transformers.generation_utils import calc_banned_bad_words_ids
prev_input_ids = torch.tensor([[1, 2, 3, 4, 5]])
bad_words_ids = [[4, 5, 9]]
banned_tokens = calc_banned_bad_words_ids(prev_input_ids, bad_words_ids)
print(banned_tokens)
```
output `[[]]`，but we expect to output  `[[9]]`.


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

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

```diff
@@            Coverage Diff             @@
##           master    #6387      +/-   ##
==========================================
+ Coverage   79.94%   80.07%   +0.12%     
==========================================
  Files         153      153              
  Lines       27902    27902              
==========================================
+ Hits        22307    22343      +36     
+ Misses       5595     5559      -36     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/6387?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/generation\_tf\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/6387/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9nZW5lcmF0aW9uX3RmX3V0aWxzLnB5) | `86.46% <100.00%> (-0.26%)` | :arrow_down: |
| [src/transformers/generation\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/6387/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9nZW5lcmF0aW9uX3V0aWxzLnB5) | `96.92% <100.00%> (ø)` | |
| [src/transformers/modeling\_tf\_flaubert.py](https://codecov.io/gh/huggingface/transformers/pull/6387/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9mbGF1YmVydC5weQ==) | `24.53% <0.00%> (-63.20%)` | :arrow_down: |
| [src/transformers/modeling\_tf\_distilbert.py](https://codecov.io/gh/huggingface/transformers/pull/6387/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9kaXN0aWxiZXJ0LnB5) | `97.41% <0.00%> (+32.94%)` | :arrow_up: |

------

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


@sshleifer 
1. As suggested, I fixed docsrtings.

2.  `RUN_SLOW=1 pytest tests/test_modeling_bart.py` outputs `collected 47 items: 45 passed, 2 skipped, 15 warnings`
     `RUN_SLOW=1 pytest tests/test_modeling_marian.py` outputs `collected 15 items: 15 passed, 111 warnings`
     `RUN_SLOW=1 pytest tests/test_modeling_t5.py` outputs `collected 35 items: 33 passed, 2 skipped, 198 warnings`
     `RUN_SLOW=1 pytest tests/test_modeling_mbart.py`  outputs `collected 6 items: 1 failed, 3 passed, 2 skipped, 105 warnings`

     For the failed test, the detailed output is as follows：

```
     ___________________________________ MBartEnroIntegrationTest.test_enro_generate ___________________________________ 

self = <tests.test_modeling_mbart.MBartEnroIntegrationTest testMethod=test_enro_generate>

    @slow
    def test_enro_generate(self):
        batch: BatchEncoding = self.tokenizer.prepare_seq2seq_batch(self.src_text).to(torch_device)
        translated_tokens = self.model.generate(**batch)
        decoded = self.tokenizer.batch_decode(translated_tokens, skip_special_tokens=True)
        self.assertEqual(self.tgt_text[0], decoded[0])
>       self.assertEqual(self.tgt_text[1], decoded[1])
E       AssertionError: 'Secr[223 chars]înrăutăţească violenţa şi mizeria pentru milioane de oameni.' != 'Secr[223 chars]înrăutăţească violenţele şi mizeria pentru milioane de oameni.'
E       Diff is 1089 characters long. Set self.maxDiff to None to see it.

tests\test_modeling_mbart.py:89: AssertionError
```
Even if I restore the modified code, the test still fails. So the failed test has nothing to do with the code I modified.

Does the failure also happen on your machine on master? Otherwise it does seem like your code causes the failure. That translation is created by the generate function.

@sshleifer

The failure also happen  on master branch and the master brach has been updated to the latest.
My machine is Win10 64 bit and test environment is Python 3.8.3, pytest-6.0.1, py-1.9.0, pluggy-0.13.1，pytorch-1.6.0.

On the other hand , I debugged the failed test code, as shown below：
```python
from transformers import (
    AutoModelForSeq2SeqLM,
    BartConfig,
    BartForConditionalGeneration,
    BatchEncoding,
    AutoTokenizer,
)

src_text = [
    " UN Chief Says There Is No Military Solution in Syria",
    """ Secretary-General Ban Ki-moon says his response to Russia's steppedupmilitary support for Syria is that "there is no military solution"to thenearly five-year conflict and more weapons will only worsen theviolenceand misery for millions of people.""",
]
tgt_text = [
    "Şeful ONU declară că nu există o soluţie militară în Siria",
    'Secretarul General Ban Ki-moon declară că răspunsul său laintensificareasprijinului militar al Rusiei pentru Siria este că "nuexistă o soluţiemilitară" la conflictul de aproape cinci ani şi că noiarme nu vor facedecât să înrăutăţească violenţa şi mizeria pentrumilioane de oameni.',
]
tokenizer = AutoTokenizer.from_pretrained("facebook/mbart-large-en-ro")
model = AutoModelForSeq2SeqLM.from_pretrained("facebook/mbart-large-en-ro")
batch: BatchEncoding = tokenizer.prepare_seq2seq_batch(src_text)
translated_tokens = model.generate(**batch)
decoded = tokenizer.batch_decode(translated_tokens, skip_special_tokens=True)
assert(tgt_text[0] == decoded[0])
assert(tgt_text[1] == decoded[1]) 
```
By debugging, I find that  `bad_words_ids` is `None` in `generate` function. So the code I modified will not run during this test and will not affect the results of `generate` function.

Great @ZhuBaohe, thanks for running the tests and fixing the bad word tokens.