Current trainer.py doesn't support beam search
# 🚀 Feature request

Currently I can't find any support for beam search in trainer.py - to begin with it doesn't even import the BearScorer or BeamHypotheses classes and the evaluation_loop and prediction_loop don't make any use of beam search logic internally.  Its misleading because in the predict and evaluate functions in trainer_seq2seq.py it includes setting the self._num_beams to a passed in hyper parameter however that isn't used by the parent predict or evaluate functions.  Also the run_summarization.py script also includes a beam search hyperparameter which isn't made use of.  What would be the simplest way to have an evaluation and prediction step call and evaluate beam search?

## Motivation

Beam search is very critical for the evaluation of seq2seq methods.  HuggingFace must have a trainer that does integrate with beam search just not sure where it is exposed / how that integration works.  Currently for reference https://github.com/huggingface/transformers/blob/master/src/transformers/trainer.py#L2342 the prediction_step doesn't call beam search / perform beam search and this is called to get the loss, logits, labels for each step in evaluation.  Thus it isn't actually performing a search over all the possible beams and instead evaluating for each next step in the dataloader.  

## Your contribution

I would further look into how the Beam search util file is used in other models.  The code exists https://github.com/huggingface/transformers/blob/master/src/transformers/generation_utils.py#L1612 I just wonder why trainer.py isn't calling it in the evaluate or predict functions - is there a reason for that? @patil-suraj 



This post on the forum will answer your question: https://discuss.huggingface.co/t/trainer-vs-seq2seqtrainer/3145/2?u=nielsr<|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.