Effect of selecting both `do_sample` and `num_beams` in summarization pipeline
I am using a summarization pipeline to generate summaries using a fine-tuned model. Thesummarizerobject is initialised as follows:summarizer = pipeline(
        "summarization", 
        model=model, 
        tokenizer=tokenizer, 
        num_beams=5, 
        do_sample=True, 
        no_repeat_ngram_size=3,
        max_length=1024,
        device=0,
        batch_size=8
    )According to the documentation, settingnum_beams=5means that the top 5 choices are retained when a new token in the sequence is generated based on a language model, and the model moves forward discarding all other possibilities, so that 5 options are carried over all the time. However, this option seems to apparently be incompatible withdo_sample=Truewhere it seems that new tokens are picked based on some random strategy (which doesn’t have to be uniformly random of course, but I don’t know the details of this process). Could anyone explain clearly hownum_beams=5anddo_sample=Truewould work together (no error is raised so I assume this is a valid configuration).Many thanks