fix seq2seqtrainer predict without labels
# What does this PR do?

This PR allows to use Seq2SeqTrainer for prediction with generation on dataset without target sequence. So None loss and metrics are returned.

Technically, model.forward would be called only if we have 'labels'


Fixes #19714


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@patrickvonplaten, please check this PR.

> This means the model will not be run if there are no labels. I don't think this fixes the issue as you wanted.

Thank for your reply.

In fact, in `prediction_step()` `model.generate` is still called, so trainer.predict would return generated_tokens, but would not compute loss.
See [here](https://github.com/huggingface/transformers/blob/dd523da577f3d1471d570f0bc388af55d026ce95/src/transformers/trainer_seq2seq.py#L198).

I have tried the new trainer by myself and the code snippet from the issue works properly.


<|||||>_The documentation is not available anymore as the PR was closed or merged._