Add implementation of typical sampling
# What does this PR do?

Adds an implementation of typical sampling (https://arxiv.org/abs/2202.00666) to the `generate` function
_The documentation is not available anymore as the PR was closed or merged._<|||||>Looks cool! Could you add one test? :-)<|||||>> Looks cool! Could you add one test? :-)

Added a test and fixed the style issues :)<|||||>Of course! Are we waiting on @thomwolf at this point? Or is there something else that has to happen before merging?<|||||>I confirm, very clean! Good job @cimeister <|||||>@cimeister You are using `nansum` here, which is available in torch>=1.7.0. @patrickvonplaten Does approving this for main branch means `transformers` drop support for torch<1.7.0 ?<|||||>Ah nice catch @LSinev 
@patrickvonplaten should we change to something like:
```
plogp = p * normalized 
ent = - plogp[~torch.isnan(plogp)].sum(-1, keepdim=True)
```<|||||>Same answer here is given by @sgugger here: https://github.com/huggingface/transformers/pull/13292#discussion_r837529073 . Would be great if someone could open a PR to fix it :-)