class_docstr: Sampling parameters for text generation.
  
  Overall, we follow the sampling parameters from the OpenAI text completion
  API (https://platform.openai.com/docs/api-reference/completions/create).
  In addition, we support beam search, which is not supported by OpenAI.
  
  Args:
      n: Number of output sequences to return for the given prompt.
      best_of: Number of output sequences that are generated from the prompt.
          From these `best_of` sequences, the top `n` sequences are returned.
          `best_of` must be greater than or equal to `n`. This is treated as
          the beam width when `use_beam_search` is True. By default, `best_of`
          is set to `n`.
      presence_penalty: Float that penalizes new tokens based on whether they
          appear in the generated text so far. Values > 0 encourage the model
          to use new tokens, while values < 0 encourage the model to repeat
          tokens.
      frequency_penalty: Float that penalizes new tokens based on their
          frequency in the generated text so far. Values > 0 encourage the
          model to use new tokens, while values < 0 encourage the model to
          repeat tokens.
      temperature: Float that controls the randomness of the sampling. Lower
          values make the model more deterministic, while higher values make
          the model more random. Zero means greedy sampling.
      top_p: Float that controls the cumulative probability of the top tokens
          to consider. Must be in (0, 1]. Set to 1 to consider all tokens.
      top_k: Integer that controls the number of top tokens to consider. Set
          to -1 to consider all tokens.
      use_beam_search: Whether to use beam search instead of sampling.
      length_penalty: Float that penalizes sequences based on their length.
          Used in beam search.
      early_stopping: Controls the stopping condition for beam search. It
          accepts the following values: `True`, where the generation stops as
          soon as there are `best_of` complete candidates; `False`, where an
          heuristic is applied and the generation stops when is it very
          unlikely to find better candidates; `"never"`, where the beam search
          procedure only stops when there cannot be better candidates
          (canonical beam search algorithm).
      stop: List of strings that stop the generation when they are generated.
          The returned output will not contain the stop strings.
      stop_token_ids: List of tokens that stop the generation when they are
          generated. The returned output will contain the stop tokens unless
          the stop tokens are sepcial tokens.
      ignore_eos: Whether to ignore the EOS token and continue generating
          tokens after the EOS token is generated.
      max_tokens: Maximum number of tokens to generate per output sequence.
      logprobs: Number of log probabilities to return per output token.
      skip_special_tokens: Whether to skip special tokens in the output.
class_docstr_tok: ["Sampling","parameters","for","text","generation",".","Overall",",","we","follow","the","sampling","parameters","from","the","OpenAI","text","completion","API","(","https",":","\/\/platform.openai.com\/docs\/api-reference\/completions\/create",")",".","In","addition",",","we","support","beam","search",",","which","is","not","supported","by","OpenAI",".","Args",":","n",":","Number","of","output","sequences","to","return","for","the","given","prompt",".","best_of",":","Number","of","output","sequences","that","are","generated","from","the","prompt",".","From","these","`","best_of","`","sequences",",","the","top","`","n","`","sequences","are","returned",".","`","best_of","`","must","be","greater","than","or","equal","to","`","n","`",".","This","is","treated","as","the","beam","width","when","`","use_beam_search","`","is","True",".","By","default",",","`","best_of","`","is","set","to","`","n","`",".","presence_penalty",":","Float","that","penalizes","new","tokens","based","on","whether","they","appear","in","the","generated","text","so","far",".","Values",">","0","encourage","the","model","to","use","new","tokens",",","while","values","<","0","encourage","the","model","to","repeat","tokens",".","frequency_penalty",":","Float","that","penalizes","new","tokens","based","on","their","frequency","in","the","generated","text","so","far",".","Values",">","0","encourage","the","model","to","use","new","tokens",",","while","values","<","0","encourage","the","model","to","repeat","tokens",".","temperature",":","Float","that","controls","the","randomness","of","the","sampling",".","Lower","values","make","the","model","more","deterministic",",","while","higher","values","make","the","model","more","random",".","Zero","means","greedy","sampling",".","top_p",":","Float","that","controls","the","cumulative","probability","of","the","top","tokens","to","consider",".","Must","be","in","(","0",",","1","]",".","Set","to","1","to","consider","all","tokens",".","top_k",":","Integer","that","controls","the","number","of","top","tokens","to","consider",".","Set","to","-1","to","consider","all","tokens",".","use_beam_search",":","Whether","to","use","beam","search","instead","of","sampling",".","length_penalty",":","Float","that","penalizes","sequences","based","on","their","length",".","Used","in","beam","search",".","early_stopping",":","Controls","the","stopping","condition","for","beam","search",".","It","accepts","the","following","values",":","`","True","`",",","where","the","generation","stops","as","soon","as","there","are","`","best_of","`","complete","candidates",";","`","False","`",",","where","an","heuristic","is","applied","and","the","generation","stops","when","is","it","very","unlikely","to","find","better","candidates",";","`","``","never","''","`",",","where","the","beam","search","procedure","only","stops","when","there","can","not","be","better","candidates","(","canonical","beam","search","algorithm",")",".","stop",":","List","of","strings","that","stop","the","generation","when","they","are","generated",".","The","returned","output","will","not","contain","the","stop","strings",".","stop_token_ids",":","List","of","tokens","that","stop","the","generation","when","they","are","generated",".","The","returned","output","will","contain","the","stop","tokens","unless","the","stop","tokens","are","sepcial","tokens",".","ignore_eos",":","Whether","to","ignore","the","EOS","token","and","continue","generating","tokens","after","the","EOS","token","is","generated",".","max_tokens",":","Maximum","number","of","tokens","to","generate","per","output","sequence",".","logprobs",":","Number","of","log","probabilities","to","return","per","output","token",".","skip_special_tokens",":","Whether","to","skip","special","tokens","in","the","output","."]
code: def _verify_args(self) -> None:
      if self.n < 1:
          invalidInputError(f"n must be at least 1, got {self.n}.")
      if self.best_of < self.n:
          invalidInputError(
              f"best_of must be greater than or equal to n, "
              f"got n={self.n} and best_of={self.best_of}."
          )
      if not -2.0 <= self.presence_penalty <= 2.0:
          invalidInputError(
              "presence_penalty must be in [-2, 2], got "
              f"{self.presence_penalty}."
          )
      if not -2.0 <= self.frequency_penalty <= 2.0:
          invalidInputError(
              "frequency_penalty must be in [-2, 2], got "
              f"{self.frequency_penalty}."
          )
      if self.temperature < 0.0:
          invalidInputError(
              f"temperature must be non-negative, got {self.temperature}."
          )
      if not 0.0 < self.top_p <= 1.0:
          invalidInputError(
              f"top_p must be in (0, 1], got {self.top_p}."
          )
      if self.top_k < -1 or self.top_k == 0:
          invalidInputError(
              f"top_k must be -1 (disable), or at least 1, "
              f"got {self.top_k}."
          )
      if self.max_tokens < 1:
          invalidInputError(
              f"max_tokens must be at least 1, got {self.max_tokens}."
          )
      if self.logprobs is not None and self.logprobs < 0:
          invalidInputError(
              f"logprobs must be non-negative, got {self.logprobs}."
          )
  
file_path: BigDL/python/llm/src/bigdl/llm/vllm/sampling_params.py
imports: from enum import IntEnum
  from functools import cached_property
  from typing import List, Optional, Union
  from bigdl.llm.utils.common import invalidInputError
label_desc: Use image node_id 2 for calling the SamplingParams obj's underlying member method code with example usage: obj._verify_args() without return types