code: def __init__(
      self,
      prompt_seqs: Tensor,
      prompt_padding_mask: Optional[PaddingMask],
      sampler: Sampler,
      vocab_info: VocabularyInfo,
      num_gens: int,
      min_gen_len: int,
      max_gen_len: int,
      max_seq_len: int,
      echo_prompt: bool,
      compute_scores: bool,
      normalize_scores: bool,
      temperature: float,
      unk_penalty: float,
      len_penalty: float,
      prefill_chunk_size: Optional[int],
      decode_capacity_increment: Optional[int],
      step_processors: List[StepProcessor],
      step_hooks: Dict[int, StepHook],
  ) -> None:
      self.sampler = sampler
  
      assert vocab_info.eos_idx is not None
  
      self.eos_idx = vocab_info.eos_idx
      self.pad_idx = vocab_info.pad_idx
      self.unk_idx = vocab_info.unk_idx
  
      self.num_gens = num_gens
  
      min_prompt_idx: Union[int, Tensor]
      max_prompt_idx: Union[int, Tensor]
  
      if prompt_padding_mask is None:
          self.min_prompt_len, min_prompt_idx = prompt_seqs.size(1), 0
          self.max_prompt_len, max_prompt_idx = prompt_seqs.size(1), 0
      else:
          prompt_seq_lens = prompt_padding_mask.seq_lens
  
          min_prompt_len, min_prompt_idx = torch.min(
              prompt_seq_lens, dim=0
          )
          max_prompt_len, max_prompt_idx = torch.max(
              prompt_seq_lens, dim=0
          )
  
          self.min_prompt_len = int(min_prompt_len)
          self.max_prompt_len = int(max_prompt_len)
  
          if self.min_prompt_len == self.max_prompt_len:
              prompt_padding_mask = None
  
      if self.min_prompt_len < 1:
          raise ValueError(
              f"`prompt_seqs[{int(min_prompt_idx)}]` must not be empty."
          )
  
      if self.max_prompt_len >= max_seq_len:
          raise ValueError(
              f"The length of `prompt_seqs[{int(max_prompt_idx)}]` must be less than `max_seq_len` ({max_seq_len}), but is {self.max_prompt_len} instead."
          )
  
      self.min_seq_len = min(
          max_seq_len, self.max_prompt_len + min_gen_len
      )
      self.max_seq_len = min(
          max_seq_len, self.max_prompt_len + max_gen_len
      )
  
      self.echo_prompt = echo_prompt
      self.compute_scores = compute_scores
      self.normalize_scores = normalize_scores
      self.temperature = temperature
      self.unk_penalty = unk_penalty
      self.len_penalty = len_penalty
      self.prefill_chunk_size = prefill_chunk_size
      self.step_processors = step_processors
      self.step_hooks = step_hooks
  
      self.step_nr = 0
  
      self.state_bag = IncrementalStateBag(
          self.max_seq_len, capacity_increment=decode_capacity_increment
      )
  
      if prompt_padding_mask is None:
          self.prompt_lens = None
          self.prompt_mask = None
      else:
          # (P)
          self.prompt_lens = prompt_padding_mask.seq_lens
  
          # (P, S_prm)
          self.prompt_mask = prompt_padding_mask.materialize()
  
      device = prompt_seqs.device
  
      num_prompts = prompt_seqs.size(0)
  
      # Holds the prompt indices of the generated sequences.
      # (P)
      self.prompt_indices = torch.arange(num_prompts, device=device)
  
      # Holds the generated sequences.
      # (P, S)
      self.seqs = torch.empty(
          (num_prompts, self.max_seq_len),
          device=device,
          dtype=torch.int64,
      )
  
      if self.compute_scores:
          # Holds the step scores of the generated sequences.
          # (P, S)
          self.step_scores = torch.zeros(
              (num_prompts, self.max_seq_len),
              device=device,
              dtype=torch.float32,
          )
      else:
          self.step_scores = None
  
      # Bootstrap the sequences.
      self.seqs[:, : self.max_prompt_len] = prompt_seqs[
          :, : self.max_prompt_len
      ]
  
      # Holds the sequences that have reached EOS.
      self.output = [[] for _ in range(num_prompts)]
  
imports: from __future__ import annotations
  from abc import ABC, abstractmethod
  from typing import Dict, List, Optional, Sequence, Tuple, Union, final
  import torch
  from torch import Tensor
  from torch.nn.functional import softmax
  from fairseq2.data import VocabularyInfo
  from fairseq2.generation.generator import Hypothesis, Seq2SeqGenerator, Seq2SeqGeneratorOutput, SequenceGenerator, SequenceGeneratorOutput, StepHook
  from fairseq2.generation.step_processor import StepProcessor
  from fairseq2.models.decoder import DecoderModel
  from fairseq2.models.encoder_decoder import EncoderDecoderModel
  from fairseq2.models.sequence import SequenceModelOutput
  from fairseq2.nn.incremental_state import IncrementalStateBag
  from fairseq2.nn.ops import repeat_interleave
  from fairseq2.nn.padding import PaddingMask
  from fairseq2.typing import finaloverride, override
label_desc: Use image node_id 1 to create a new _SamplingSequenceGeneratorOpBase object from inherited base classes: ABC with example: obj = _SamplingSequenceGeneratorOpBase(prompt_seqs, prompt_padding_mask, sampler, vocab_info, num_gens, min_gen_len, max_gen_len, max_seq_len, echo_prompt, compute_scores, normalize_scores, temperature, unk_penalty, len_penalty, prefill_chunk_size, decode_capacity_increment, step_processors, step_hooks)