class_docstr: A class containing all of the functions supporting generation, to be used as a mixin in [`TFPreTrainedModel`].
class_docstr_tok: ["A","class","containing","all","of","the","functions","supporting","generation",",","to","be","used","as","a","mixin","in","[","`","TFPreTrainedModel","`","]","."]
docstr: Validates model kwargs for generation. Generate argument typos will also be caught here.
code: def _validate_model_kwargs(self, model_kwargs: Dict[str, Any]):
      """Validates model kwargs for generation. Generate argument typos will also be caught here."""
      # Excludes arguments that are handled before calling any model function
      if self.config.is_encoder_decoder:
          for key in ["decoder_input_ids"]:
              model_kwargs.pop(key, None)
  
      unused_model_args = []
      model_args = set(
          inspect.signature(
              self.prepare_inputs_for_generation
          ).parameters
      )
      # `kwargs` if often used to handle optional forward pass inputs like `attention_mask`. If
      # `prepare_inputs_for_generation` doesn't accept `kwargs`, then a stricter check can be made ;)
      if "kwargs" in model_args:
          model_args |= set(inspect.signature(self.call).parameters)
      for key, value in model_kwargs.items():
          if value is not None and key not in model_args:
              unused_model_args.append(key)
  
      if unused_model_args:
          raise ValueError(
              f"The following `model_kwargs` are not used by the model: {unused_model_args} (note: typos in the"
              " generate arguments will also show up in this list)"
          )
  
imports: import inspect
  import warnings
  from dataclasses import dataclass
  from typing import Any, Dict, List, Optional, Tuple, Union
  import numpy
  import tensorflow
  from tensorflow.compiler.tf2xla.python.xla import dynamic_update_slice
  from .generation_tf_logits_process import TFForcedBOSTokenLogitsProcessor, TFForcedEOSTokenLogitsProcessor, TFForceTokensLogitsProcessor, TFLogitsProcessorList, TFMinLengthLogitsProcessor, TFNoBadWordsLogitsProcessor, TFNoRepeatNGramLogitsProcessor, TFRepetitionPenaltyLogitsProcessor, TFSuppressTokensAtBeginLogitsProcessor, TFSuppressTokensLogitsProcessor, TFTemperatureLogitsWarper, TFTopKLogitsWarper, TFTopPLogitsWarper
  from .models.auto import TF_MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING, TF_MODEL_FOR_VISION_2_SEQ_MAPPING
  from .tf_utils import shape_list, stable_softmax
  from .utils import ModelOutput, logging
label_desc: Use image node_id 8 for calling the TFGenerationMixin obj's underlying member method code with example usage: obj._validate_model_kwargs(model_kwargs) without return types