docstr: 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.
docstr_tok: ["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","."]
code: def is_done(self, best_sum_logprobs: float, cur_len: int) -> bool:
      """
      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.
      """
  
      if len(self) < self.num_beams:
          return False
      elif self.early_stopping:
          return True
      else:
          cur_score = best_sum_logprobs / cur_len**self.length_penalty
          ret = self.worst_score >= cur_score
          return ret
  
imports: import warnings
  from abc import ABC, abstractmethod
  from collections import UserDict
  from typing import List, Optional, Tuple
  import numpy
  import torch
  from .generation_beam_constraints import Constraint, ConstraintListState
  from .utils import add_start_docstrings
label_desc: Use image node_id 4 for calling the BeamHypotheses obj's underlying member method code with example usage: obj.is_done(best_sum_logprobs, cur_len) and returns: False, True, ret