megatron.text_generation.beam_utils.BeamHypotheses#
- class megatron.text_generation.beam_utils.BeamHypotheses(num_beams, length_penalty=1.0, early_stopping=False)#
Bases:
object
- __len__()#
Number of hypotheses in the list.
- add(hyp, sum_logprobs, length)#
Add a new hypothesis to the list.
- is_done(best_sum_logprobs, cur_len)#
If there are enough hypotheses and that none of the hypotheses being generated can become better than the worst one in the heap, then we are done with this sentence.