About max_length in generation_utils.py
In `generation_utils.py`, the docstring of the `beam_search` function shows the example of usage.

```
>>> input_ids = torch.ones((num_beams, 1), device=model.device, dtype=torch.long)
>>> input_ids = input_ids * model.config.decoder_start_token_id

>>> something else that I omit here

>>> outputs = model.beam_search(input_ids, beam_scorer, logits_processor=logits_processor, **model_kwargs)
```

The `beam_search` function uses `while cur_len < max_length` to control the length of generated sequence. But the `cur_len` counts the length including the start token which is a special token. When the user sets `max_length = 1`, does it not mean that the user wants the model to generate one token **while not considering the start token** (I am not sure that is it just me or others may think that way too)? But the `cur_len` will be 1 at the beginning because of the start token and the statement below in the source code.

```
batch_beam_size, cur_len = input_ids.shape
```

The control flow will jump out of the `while` loop and not generate any token.

Maybe `while cur_len < max_length` should be changed to `while cur_len <= max_length`. And maybe other functions should also change the corresponding loop control statement if I am right.
Hey @LinjianLi,

note that `max_length` states the maximum length of both generated tokens and input tokens (which is always at least 1). This means that we count the first special token also as an output token (it will be in the final output) and thus should also be included when computing `max_length`<|||||>> Hey @LinjianLi,
> 
> note that `max_length` states the maximum length of both generated tokens and input tokens (which is always at least 1). This means that we count the first special token also as an output token (it will be in the final output) and thus should also be included when computing `max_length`

Thanks for your reply!