class_docstr: [`TFLogitsProcessor`] that enforces that specified sequences will never be sampled.
  
  Args:
      bad_words_ids (`List[List[int]]`):
          List of list of token ids that are not allowed to be generated. In order to get the tokens of the words
          that should not appear in the generated text, make sure to set `add_prefix_space=True` when initializing
          the tokenizer, and use `tokenizer(bad_words, add_special_tokens=False).input_ids`. The `add_prefix_space`
          argument is only supported for some slow tokenizers, as fast tokenizers' prefixing behaviours come from
          `pre tokenizers`. Read more [here](https://huggingface.co/docs/tokenizers/api/pre-tokenizers).
      eos_token_id (`int`):
          The id of the *end-of-sequence* token.
class_docstr_tok: ["[","`","TFLogitsProcessor","`","]","that","enforces","that","specified","sequences","will","never","be","sampled",".","Args",":","bad_words_ids","(","`","List","[","List","[","int","]","]","`",")",":","List","of","list","of","token","ids","that","are","not","allowed","to","be","generated",".","In","order","to","get","the","tokens","of","the","words","that","should","not","appear","in","the","generated","text",",","make","sure","to","set","`","add_prefix_space=True","`","when","initializing","the","tokenizer",",","and","use","`","tokenizer","(","bad_words",",","add_special_tokens=False",")",".input_ids","`",".","The","`","add_prefix_space","`","argument","is","only","supported","for","some","slow","tokenizers",",","as","fast","tokenizers","'","prefixing","behaviours","come","from","`","pre","tokenizers","`",".","Read","more","[","here","]","(","https",":","\/\/huggingface.co\/docs\/tokenizers\/api\/pre-tokenizers",")",".","eos_token_id","(","`","int","`",")",":","The","id","of","the","*","end-of-sequence","*","token","."]
code: def __init__(self, bad_words_ids: List[List[int]], eos_token_id: int):
      if not isinstance(bad_words_ids, List) or len(bad_words_ids) == 0:
          raise ValueError(
              f"`bad_words_ids` has to be a non-empty list, but is {bad_words_ids}."
          )
      if any(
          not isinstance(bad_word_ids, list)
          for bad_word_ids in bad_words_ids
      ):
          raise ValueError(
              f"`bad_words_ids` has to be a list of lists, but is {bad_words_ids}."
          )
      if any(
          any(
              (
                  not isinstance(token_id, (int, np.integer))
                  or token_id < 0
              )
              for token_id in bad_word_ids
          )
          for bad_word_ids in bad_words_ids
      ):
          raise ValueError(
              f"Each list in `bad_words_ids` has to be a list of positive integers, but is {bad_words_ids}."
          )
  
      # stores the information about bad words in three tensors:
      # 1. a rectangular tensor with the forbidden sequences (padded with `-1`), for full data comparisons
      self.bad_word_seqs_ids = tf.ragged.constant(
          bad_words_ids
      ).to_tensor(default_value=-1)
      # 2. a tensor with the unpadded length of each forbidden sequence, for quick length comparisons
      bad_word_seqs_len = [
          len(bad_words) for bad_words in bad_words_ids
      ]
      if any(word_len == 0 for word_len in bad_word_seqs_len):
          raise ValueError(
              f"Banned words token sequences {bad_words_ids} cannot have an empty list"
          )
      self.bad_word_seqs_len = tf.convert_to_tensor(
          bad_word_seqs_len, dtype=tf.int32
      )
      # 3. a tensor containing the last token for each sequence, for easy access to the tokens that may be banned
      self.seq_forbidden_tokens = tf.convert_to_tensor(
          [bad_words[-1] for bad_words in bad_words_ids]
      )
  
imports: import inspect
  from typing import List, Tuple
  import numpy
  import tensorflow
  from ..tf_utils import stable_softmax
  from ..utils import add_start_docstrings
  from ..utils.logging import get_logger
label_desc: Use image node_id 1 to create a new TFNoBadWordsLogitsProcessor object from inherited base classes: TFLogitsProcessor with example: obj = TFNoBadWordsLogitsProcessor(bad_words_ids, eos_token_id)