Configuration classes for TFLite export

Base classes

class optimum.exporters.tflite.TFLiteConfig

< >

( config: PretrainedConfig task: str batch_size: int = 1 sequence_length: typing.Optional[int] = None num_choices: typing.Optional[int] = None width: typing.Optional[int] = None height: typing.Optional[int] = None num_channels: typing.Optional[int] = None feature_size: typing.Optional[int] = None nb_max_frames: typing.Optional[int] = None audio_sequence_length: typing.Optional[int] = None point_batch_size: typing.Optional[int] = None nb_points_per_image: typing.Optional[int] = None )

Parameters

  • 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. —

Base class for TFLite exportable model describing metadata on how to export the model through the TFLite format.

Class attributes:

inputs

< >

( ) List[str]

Returns

List[str]

A list of input names.

List containing the names of the inputs the exported model should take.

outputs

< >

( ) List[str]

Returns

List[str]

A list of output names.

List containing the names of the outputs the exported model should have.

generate_dummy_inputs

< >

( ) Dict[str, tf.Tensor]

Returns

Dict[str, tf.Tensor]

A dictionary mapping input names to dummy tensors.

Generates dummy inputs that the exported model should be able to process. This method is actually used to determine the input specs that are needed for the export.

Middle-end classes

class optimum.exporters.tflite.config.TextEncoderTFliteConfig

< >

( config: PretrainedConfig task: str batch_size: int = 1 sequence_length: typing.Optional[int] = None num_choices: typing.Optional[int] = None width: typing.Optional[int] = None height: typing.Optional[int] = None num_channels: typing.Optional[int] = None feature_size: typing.Optional[int] = None nb_max_frames: typing.Optional[int] = None audio_sequence_length: typing.Optional[int] = None point_batch_size: typing.Optional[int] = None nb_points_per_image: typing.Optional[int] = None )

Handles encoder-based text architectures.

class optimum.exporters.tflite.config.VisionTFLiteConfig

< >

( config: PretrainedConfig task: str batch_size: int = 1 sequence_length: typing.Optional[int] = None num_choices: typing.Optional[int] = None width: typing.Optional[int] = None height: typing.Optional[int] = None num_channels: typing.Optional[int] = None feature_size: typing.Optional[int] = None nb_max_frames: typing.Optional[int] = None audio_sequence_length: typing.Optional[int] = None point_batch_size: typing.Optional[int] = None nb_points_per_image: typing.Optional[int] = None )

Handles vision architectures.

< > Update on GitHub