class_docstr: An LLM engine that receives requests and generates texts.
  
  This is the main class for the vLLM engine. It receives requests
  from clients and generates texts from the LLM. It includes a tokenizer, a
  language model (possibly distributed across multiple GPUs), and GPU memory
  space allocated for intermediate states (aka KV cache). This class utilizes
  iteration-level scheduling and efficient memory management to maximize the
  serving throughput.
  
  The `LLM` class wraps this class for offline batched inference and the
  `AsyncLLMEngine` class wraps this class for online serving.
  
  NOTE: The config arguments are derived from the `EngineArgs` class. For the
  comprehensive list of arguments, see `EngineArgs`.
  
  Args:
      model_config: The configuration related to the LLM model.
      cache_config: The configuration related to the KV cache memory
          management.
      parallel_config: The configuration related to distributed execution.
      scheduler_config: The configuration related to the request scheduler.
      distributed_init_method: The initialization method for distributed
          execution. See `torch.distributed.init_process_group` for details.
      placement_group: Ray placement group for distributed execution.
          Required for distributed execution.
      log_stats: Whether to log statistics.
code: def _check_beam_search_early_stopping(
      self,
      early_stopping: Union[bool, str],
      sampling_params: SamplingParams,
      best_running_seq: Sequence,
      current_worst_seq: Sequence,
  ) -> bool:
      invalidInputError(
          sampling_params.use_beam_search, "Should be beam_search"
      )
      length_penalty = sampling_params.length_penalty
      if early_stopping is True:
          return True
  
      current_worst_score = current_worst_seq.get_beam_search_score(
          length_penalty=length_penalty,
          eos_token_id=self.tokenizer.eos_token_id,
      )
      if early_stopping is False:
          highest_attainable_score = (
              best_running_seq.get_beam_search_score(
                  length_penalty=length_penalty,
                  eos_token_id=self.tokenizer.eos_token_id,
              )
          )
      else:
          invalidInputError(
              early_stopping == "never",
              "early_stopping should be never",
          )
          if length_penalty > 0.0:
              # If length_penalty > 0.0, beam search will prefer longer
              # sequences. The highest attainable score calculation is
              # based on the longest possible sequence length in this case.
              max_possible_length = max(
                  best_running_seq.get_prompt_len()
                  + sampling_params.max_tokens,
                  self.scheduler_config.max_model_len,
              )
              highest_attainable_score = (
                  best_running_seq.get_beam_search_score(
                      length_penalty=length_penalty,
                      eos_token_id=self.tokenizer.eos_token_id,
                      seq_len=max_possible_length,
                  )
              )
          else:
              # Otherwise, beam search will prefer shorter sequences. The
              # highest attainable score calculation is based on the current
              # sequence length.
              highest_attainable_score = (
                  best_running_seq.get_beam_search_score(
                      length_penalty=length_penalty,
                      eos_token_id=self.tokenizer.eos_token_id,
                  )
              )
      return current_worst_score >= highest_attainable_score
  
imports: import time
  from typing import TYPE_CHECKING, Any, Iterable, List, Optional, Tuple, Union, Dict
  from bigdl.llm.vllm.config import ModelConfig, SchedulerConfig
  from bigdl.llm.vllm.core.scheduler import SchedulerOutputs, FixedWindowScheduler
  from bigdl.llm.vllm.engine.arg_utils import EngineArgs
  from bigdl.llm.vllm.logger import init_logger
  from bigdl.llm.vllm.outputs import RequestOutput
  from bigdl.llm.vllm.sampling_params import SamplingParams
  from bigdl.llm.vllm.sequence import SamplerOutput, Sequence, SequenceGroup, SequenceGroupMetadata, SequenceStatus, SequenceOutputs
  from bigdl.llm.vllm.transformers_utils.tokenizer import get_tokenizer, detokenize_incrementally
  from bigdl.llm.vllm.utils import Counter
  from bigdl.llm.utils.common import invalidInputError
label_desc: Use image node_id 11 for calling the LLMEngine obj's underlying member method code with example usage: obj._check_beam_search_early_stopping(early_stopping, sampling_params, best_running_seq, current_worst_seq) and returns: unknown, True