megatron.text_generation.api.beam_search_and_post_process#

megatron.text_generation.api.beam_search_and_post_process(model, prompts=None, tokens_to_generate=0, beam_size=0, add_BOS=False, stop_token=50256, num_return_gen=1, length_penalty=1, prevent_newline_after_colon=False)#

Run beam search and post-process outputs, i.e., detokenize, move to cpu and convert to list.