Fixed a bug for num_return_sequences don't take effect in Text2TextGenerationPipeline.
# Fixed a bug for num_return_sequences don't take effect in Text2TextGenerationPipeline.
The previous postprocess function always returns one result. This leads to num_return_sequences doesn't take effect in Text2TextGenerationPipeline and only can get one text result, no matter how we change the parameters.
We can get multiple text results in the postprocess method and get multiple results from Text2TextGenerationPipeline.



<!-- Remove if not applicable -->

Fixes https://github.com/huggingface/transformers/issues/13027#issuecomment-969899988


## 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/master/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [x] 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.
- [x] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/master/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/master/docs#writing-source-documentation).
- [x] Did you write any new necessary tests?






Hi @enze5088 ,

Do you mind adding a test ?
I think extending tests/test_pipelines_text2text_generation.py::Text2TextGenerationPipelineTests::test_small_model_pt would be enough (just extend with `num_return_sequences=3` and check that the returned results returns 3 strings (ideally they should be different, but given it's a random model, it might not be)<|||||>> Hi @enze5088,
> 
> Do you mind adding a test? I think extending tests/test_pipelines_text2text_generation.py::Text2TextGenerationPipelineTests::test_small_model_pt would be enough (just extend with `num_return_sequences=3` and check that the returned results returns 3 strings (ideally they should be different, but given it's a random model, it might not be)

Thank you for your reply, I extend the tests/test_pipelines_text2text_generation.py file. But I don't know what it means when check_code_quality fails and displays "test/test_pipelines_text2text_generation.py will be reformatted"
<|||||>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.<|||||>Closing back in favor of https://github.com/huggingface/transformers/pull/14988 (Same commits with code quality)