code: def __init__(self, tokenizer):
      super().__init__(tokenizer=tokenizer)
      if hasattr(self.tokenizer, "eod"):
          self.eos_id = self.tokenizer.eod
      elif hasattr(self.tokenizer, "eos_token_id"):
          self.eos_id = self.tokenizer.eos_token_id
      elif hasattr(self.tokenizer, "eos_token"):
          self.eos_id = self.tokenizer.eos_token
      else:
          raise ValueError(
              "Tokenizer must have either an `eod` or `eos_token` attribute."
          )
  
imports: import abc
  from typing import List, Union
  import torch
label_desc: Use image node_id 1 to create a new EosGenerationStopCriterion object from inherited base classes: BaseGenerationStopCriterion with example: obj = EosGenerationStopCriterion(tokenizer)