# Generating multiple sequences with \`Trainer.predict()\`

**URL:** <https://discuss.huggingface.co/t/generating-multiple-sequences-with-trainer-predict/31916>\
**Category:** Beginners\
**Created:** [February 17, 2023, 2:15pm UTC](https://discuss.huggingface.co/t/generating-multiple-sequences-with-trainer-predict/31916 "2023-02-17T14:15:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AfonsoSousa](https://avatars.discourse-cdn.com/v4/letter/a/5f9b8f/32.png) [@AfonsoSousa](https://discuss.huggingface.co/u/AfonsoSousa)\
**Post date:** [February 17, 2023, 2:15pm UTC](https://discuss.huggingface.co/t/generating-multiple-sequences-with-trainer-predict/31916/1 "2023-02-17T14:15:45Z")

</div>

Hi. I want to generate multiple sentences using `Trainer.predict()`, but cannot do so.

```auto
predict_results = trainer.predict(
    input_dataset["validation"],
    max_length=data_args.val_max_target_length,
    num_beams=generate_args.num_return_sequences * generate_args.beam_width,
    num_return_sequences=generate_args.num_return_sequences,
    num_beam_groups=generate_args.num_beam_groups,
    repetition_penalty=generate_args.repetition_penalty,
    diversity_penalty=generate_args.diversity_penalty,
    early_stopping=generate_args.early_stopping,
)

```

The above code produces as many sequences as there are entries in the dataset, but I wanted multiple per entry. Additionally, lets say I use a `num_return_sequences` of 4, the first 4 generations will be respective to sentence 1, the next 4 respective to sentence 2, up until we have `len(dataset)` sentences. How can I fix this issue? Is this a bug?
