code: def __init__(self, token: Union[str, int], tokenizer) -> None:
      super().__init__(tokenizer=tokenizer)
      if isinstance(token, str):
          token_id = self.tokenizer.encode(token)[0]
      else:
          token_id = token
      self.stop_token_id = token_id
  
imports: import abc
  from typing import List, Union
  import torch
label_desc: Use image node_id 1 to create a new TokenStopCriterion object from inherited base classes: BaseGenerationStopCriterion with example: obj = TokenStopCriterion(token, tokenizer)