class_docstr: Base class for TFLite exportable model describing metadata on how to export the model through the TFLite format.
  
  Class attributes:
  
  - NORMALIZED_CONFIG_CLASS (`Type`) -- A class derived from [`~optimum.utils.NormalizedConfig`] specifying how to
  normalize the model config.
  - DUMMY_INPUT_GENERATOR_CLASSES (`Tuple[Type]`) -- A tuple of classes derived from
  [`~optimum.utils.DummyInputGenerator`] specifying how to create dummy inputs.
  - ATOL_FOR_VALIDATION (`Union[float, Dict[str, float]]`) -- A float or a dictionary mapping task names to float,
  where the float values represent the absolute tolerance value to use during model conversion validation.
  - MANDATORY_AXES (`Tuple[Union[str, Tuple[Union[str, Tuple[str]]]]]`) -- A tuple where each element is either:
      - An axis  name, for instance "batch_size" or "sequence_length", that indicates that the axis dimension is
      needed to export the model,
      - Or a tuple containing two elements:
          - The first one is either a string or a tuple of strings and specifies for which task(s) the axis is needed
          - The second one is the axis name.
  
      For example: `MANDATORY_AXES = ("batch_size", "sequence_length", ("multiple-choice", "num_choices"))` means that
      to export the model, the batch size and sequence length values always need to be specified, and that a value
      for the number of possible choices is needed when the task is multiple-choice.
  
  Args:
      config (`transformers.PretrainedConfig`):
          The model configuration.
      task (`str`, defaults to `"feature-extraction"`):
          The task the model should be exported for.
  
      The rest of the arguments are used to specify the shape of the inputs the model can take.
      They are required or not depending on the model the `TFLiteConfig` is designed for.
class_docstr_tok: ["Base","class","for","TFLite","exportable","model","describing","metadata","on","how","to","export","the","model","through","the","TFLite","format",".","Class","attributes",":","-","NORMALIZED_CONFIG_CLASS","(","`","Type","`",")","--","A","class","derived","from","[","`","~optimum.utils.NormalizedConfig","`","]","specifying","how","to","normalize","the","model","config",".","-","DUMMY_INPUT_GENERATOR_CLASSES","(","`","Tuple","[","Type","]","`",")","--","A","tuple","of","classes","derived","from","[","`","~optimum.utils.DummyInputGenerator","`","]","specifying","how","to","create","dummy","inputs",".","-","ATOL_FOR_VALIDATION","(","`","Union","[","float",",","Dict","[","str",",","float","]","]","`",")","--","A","float","or","a","dictionary","mapping","task","names","to","float",",","where","the","float","values","represent","the","absolute","tolerance","value","to","use","during","model","conversion","validation",".","-","MANDATORY_AXES","(","`","Tuple","[","Union","[","str",",","Tuple","[","Union","[","str",",","Tuple","[","str","]","]","]","]","]","`",")","--","A","tuple","where","each","element","is","either",":","-","An","axis","name",",","for","instance","``","batch_size","''","or","``","sequence_length","''",",","that","indicates","that","the","axis","dimension","is","needed","to","export","the","model",",","-","Or","a","tuple","containing","two","elements",":","-","The","first","one","is","either","a","string","or","a","tuple","of","strings","and","specifies","for","which","task","(","s",")","the","axis","is","needed","-","The","second","one","is","the","axis","name",".","For","example",":","`","MANDATORY_AXES","=","(","``","batch_size","''",",","``","sequence_length","''",",","(","``","multiple-choice","''",",","``","num_choices","''",")",")","`","means","that","to","export","the","model",",","the","batch","size","and","sequence","length","values","always","need","to","be","specified",",","and","that","a","value","for","the","number","of","possible","choices","is","needed","when","the","task","is","multiple-choice",".","Args",":","config","(","`","transformers.PretrainedConfig","`",")",":","The","model","configuration",".","task","(","`","str","`",",","defaults","to","`","``","feature-extraction","''","`",")",":","The","task","the","model","should","be","exported","for",".","The","rest","of","the","arguments","are","used","to","specify","the","shape","of","the","inputs","the","model","can","take",".","They","are","required","or","not","depending","on","the","model","the","`","TFLiteConfig","`","is","designed","for","."]
docstr: Creates the signatures that will be used when exporting the model to a `tf.SavedModel`.
  Each signature can be used to perform inference on the model for a given set of inputs.
  
  Auto-encoder models have only one signature, decoder models can have two, one for the decoder without
  caching, and one for the decoder with caching, seq2seq models can have three, and so on.
docstr_tok: ["Creates","the","signatures","that","will","be","used","when","exporting","the","model","to","a","`","tf.SavedModel","`",".","Each","signature","can","be","used","to","perform","inference","on","the","model","for","a","given","set","of","inputs",".","Auto-encoder","models","have","only","one","signature",",","decoder","models","can","have","two",",","one","for","the","decoder","without","caching",",","and","one","for","the","decoder","with","caching",",","seq2seq","models","can","have","three",",","and","so","on","."]
code: def model_to_signatures(
      self, model: "TFPreTrainedModel", **model_kwargs: Any
  ) -> Dict[str, "tf.types.experimental.ConcreteFunction"]:
      """
      Creates the signatures that will be used when exporting the model to a `tf.SavedModel`.
      Each signature can be used to perform inference on the model for a given set of inputs.
  
      Auto-encoder models have only one signature, decoder models can have two, one for the decoder without
      caching, and one for the decoder with caching, seq2seq models can have three, and so on.
      """
      input_names = self.inputs
      output_names = self.outputs
  
      def forward(*args):
          if len(args) != len(input_names):
              raise ArgumentError(
                  f"The number of inputs provided ({len(args)} do not match the number of expected inputs: "
                  f"{', '.join(input_names)}."
              )
          kwargs = dict(zip(input_names, args))
          outputs = model.call(**kwargs, **model_kwargs)
          return {
              key: value
              for key, value in outputs.items()
              if key in output_names
          }
  
      function = tf.function(
          forward, input_signature=self.inputs_specs
      ).get_concrete_function()
  
      return {"model": function}
  
imports: from abc import ABC, abstractmethod
  from ctypes import ArgumentError
  from dataclasses import dataclass
  from enum import Enum
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Type, Union
  from transformers.utils import is_tf_available
  from ..base import ExportConfig
label_desc: Use image node_id 14 for calling the TFLiteConfig obj's underlying member method code with example usage: obj.model_to_signatures(model) and returns: dict, unknown