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.
code: def is_done(self, 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.
      """
      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 inspect
  import warnings
  from dataclasses import dataclass
  from typing import Any, Dict, List, Optional, Tuple, Union
  import numpy
  import tensorflow
  from tensorflow.compiler.tf2xla.python.xla import dynamic_update_slice
  from .generation_tf_logits_process import TFForcedBOSTokenLogitsProcessor, TFForcedEOSTokenLogitsProcessor, TFForceTokensLogitsProcessor, TFLogitsProcessorList, TFMinLengthLogitsProcessor, TFNoBadWordsLogitsProcessor, TFNoRepeatNGramLogitsProcessor, TFRepetitionPenaltyLogitsProcessor, TFSuppressTokensAtBeginLogitsProcessor, TFSuppressTokensLogitsProcessor, TFTemperatureLogitsWarper, TFTopKLogitsWarper, TFTopPLogitsWarper
  from .models.auto import TF_MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING, TF_MODEL_FOR_VISION_2_SEQ_MAPPING
  from .tf_utils import shape_list, stable_softmax
  from .utils import ModelOutput, logging
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