class_docstr: Samples the next tokens from the model's outputs.
  
  This layer does the following:
  1. Discard the hidden states that are not used for sampling (i.e., all
      tokens except the final one in each prompt).
  2. Compute the logits for the next tokens.
  3. Apply presence and frequency penalties.
  4. Apply temperature scaling.
  5. Apply top-p and top-k truncation.
  6. Sample the next tokens.
  Here, each sequence group within the batch can have different sampling
  parameters (e.g., sampling method, temperature, top-p, top-k, etc.).
class_docstr_tok: ["Samples","the","next","tokens","from","the","model","'s","outputs",".","This","layer","does","the","following",":","1",".","Discard","the","hidden","states","that","are","not","used","for","sampling","(","i.e.",",","all","tokens","except","the","final","one","in","each","prompt",")",".","2",".","Compute","the","logits","for","the","next","tokens",".","3",".","Apply","presence","and","frequency","penalties",".","4",".","Apply","temperature","scaling",".","5",".","Apply","top-p","and","top-k","truncation",".","6",".","Sample","the","next","tokens",".","Here",",","each","sequence","group","within","the","batch","can","have","different","sampling","parameters","(","e.g.",",","sampling","method",",","temperature",",","top-p",",","top-k",",","etc",".",")","."]
code: def __init__(
      self, vocab_size: int, device: Optional[str] = None
  ) -> None:
      super().__init__()
      self.vocab_size = vocab_size
      if device == "xpu":
          import intel_extension_for_pytorch as ipex
  
imports: from typing import Dict, List, Optional, Tuple
  import torch
  import torch.nn
  from bigdl.llm.vllm.model_executor.input_metadata import InputMetadata
  from bigdl.llm.vllm.sampling_params import SamplingParams, SamplingType
  from bigdl.llm.vllm.sequence import SamplerOutput, SequenceGroupMetadata, SequenceData, SequenceOutputs
  import time
label_desc: Use image node_id 1 to create a new BigDLSampler object from inherited base classes: nn with example: obj = BigDLSampler(vocab_size, device)