code: def __init__(self, keywords, tokenizer, input_ids):
      self.keywords = keywords
      self.keyword_ids = []
      for keyword in keywords:
          cur_keyword_ids = tokenizer(keyword).input_ids
          if (
              len(cur_keyword_ids) > 1
              and cur_keyword_ids[0] == tokenizer.bos_token_id
          ):
              cur_keyword_ids = cur_keyword_ids[1:]
          self.keyword_ids.append(torch.tensor(cur_keyword_ids))
      self.tokenizer = tokenizer
      self.start_len = input_ids.shape[1]
  
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 1 to create a new KeywordsStoppingCriteria object from inherited base classes: StoppingCriteria with example: obj = KeywordsStoppingCriteria(keywords, tokenizer, input_ids)