code: def __call__(
      self,
      output_ids: torch.LongTensor,
      scores: torch.FloatTensor,
      **kwargs,
  ) -> bool:
      assert (
          output_ids.shape[0] == 1
      ), "Only support batch size 1 (yet)"  # TODO
      offset = min(output_ids.shape[1] - self.start_len, 3)
      self.keyword_ids = [
          keyword_id.to(output_ids.device)
          for keyword_id in self.keyword_ids
      ]
      for keyword_id in self.keyword_ids:
          if output_ids[0, -keyword_id.shape[0] :] == keyword_id:
              return True
      outputs = self.tokenizer.batch_decode(
          output_ids[:, -offset:], skip_special_tokens=True
      )[0]
      for keyword in self.keywords:
          if keyword in outputs:
              return True
      return False
  
file_path: ml-ferret/ferret/mm_utils.py
imports: from PIL import Image
  from io import BytesIO
  import base64
  import torch
  from transformers import StoppingCriteria
  from ferret.constants import IMAGE_TOKEN_INDEX
label_desc: Use image node_id 2 for calling the KeywordsStoppingCriteria obj's underlying member method code with example usage: obj.__call__(output_ids, scores) and returns: False, True, True