code: def __init__(
      self,
      stops=[],
      stop_words=[],
      encounters=[],
      device="cuda",
      model_max_length=None,
      tokenizer=None,
      truncation_generation=False,
  ):
      super().__init__()
      assert (
          len(stops) % len(encounters) == 0
      ), "Number of stops and encounters must match"
      self.encounters = encounters
      self.stops = [stop.to(device) for stop in stops]
      self.stop_words = stop_words
      self.num_stops = [0] * len(stops)
      self.model_max_length = model_max_length
      self.tokenizer = tokenizer
      self.truncation_generation = truncation_generation
      self.token_start = None
      # not setup for handling existing prompt, only look at new tokens, some models like xwin have funny token handling,
      # and despite new tokens present the block looks back into different sized output and matches the stop token
      self.look_at_new_tokens_only = max(self.encounters) == 1
  
imports: import torch
  from transformers import StoppingCriteria, StoppingCriteriaList
  from enums import PromptType, t5_type
label_desc: Use image node_id 1 to create a new StoppingCriteriaSub object from inherited base classes: StoppingCriteria with example: obj = StoppingCriteriaSub(stops, stop_words, encounters, device, model_max_length, tokenizer, truncation_generation)