class_docstr: API for creating and training a text classification model.
class_docstr_tok: ["API","for","creating","and","training","a","text","classification","model","."]
docstr: Converts and saves the model to a TFLite file with metadata included.
  
  Note that only the TFLite file is needed for deployment. This function also
  saves a metadata.json file to the same directory as the TFLite file which
  can be used to interpret the metadata content in the TFLite file.
  
  Args:
    model_name: File name to save TFLite model with metadata. The full export
      path is {self._hparams.export_dir}/{model_name}.
    quantization_config: The configuration for model quantization.
code: def export_model(
      self,
      model_name: str = "model.tflite",
      quantization_config: Optional[
          quantization.QuantizationConfig
      ] = None,
  ):
      """Converts and saves the model to a TFLite file with metadata included.
  
      Note that only the TFLite file is needed for deployment. This function also
      saves a metadata.json file to the same directory as the TFLite file which
      can be used to interpret the metadata content in the TFLite file.
  
      Args:
        model_name: File name to save TFLite model with metadata. The full export
          path is {self._hparams.export_dir}/{model_name}.
        quantization_config: The configuration for model quantization.
      """
      tf.io.gfile.makedirs(self._hparams.export_dir)
      tflite_file = os.path.join(self._hparams.export_dir, model_name)
      metadata_file = os.path.join(
          self._hparams.export_dir, "metadata.json"
      )
  
      self.save_model(model_name="saved_model")
      saved_model_file = os.path.join(
          self._hparams.export_dir, "saved_model"
      )
  
      tflite_model = model_util.convert_to_tflite_from_file(
          saved_model_file, quantization_config=quantization_config
      )
      vocab_filepath = os.path.join(tempfile.mkdtemp(), "vocab.txt")
      self._save_vocab(vocab_filepath)
  
      writer = self._get_metadata_writer(tflite_model, vocab_filepath)
      tflite_model_with_metadata, metadata_json = writer.populate()
      model_util.save_tflite(tflite_model_with_metadata, tflite_file)
      with tf.io.gfile.GFile(metadata_file, "w") as f:
          f.write(metadata_json)
  
imports: import abc
  import os
  import tempfile
  from typing import Any, Optional, Sequence, Tuple
  import tensorflow
  from tensorflow_addons import optimizers
  import tensorflow_hub
  from mediapipe.model_maker.python.core.data import dataset
  from mediapipe.model_maker.python.core.tasks import classifier
  from mediapipe.model_maker.python.core.utils import hub_loader
  from mediapipe.model_maker.python.core.utils import loss_functions
  from mediapipe.model_maker.python.core.utils import metrics
  from mediapipe.model_maker.python.core.utils import model_util
  from mediapipe.model_maker.python.core.utils import quantization
  from mediapipe.model_maker.python.text.text_classifier import bert_tokenizer
  from mediapipe.model_maker.python.text.text_classifier import dataset
  from mediapipe.model_maker.python.text.text_classifier import hyperparameters
  from mediapipe.model_maker.python.text.text_classifier import model_options
  from mediapipe.model_maker.python.text.text_classifier import model_spec
  from mediapipe.model_maker.python.text.text_classifier import model_with_tokenizer
  from mediapipe.model_maker.python.text.text_classifier import preprocessor
  from mediapipe.model_maker.python.text.text_classifier import text_classifier_options
  from mediapipe.tasks.python.metadata.metadata_writers import metadata_writer
  from mediapipe.tasks.python.metadata.metadata_writers import text_classifier
label_desc: Use image node_id 5 for calling the TextClassifier obj's underlying member method code with example usage: obj.export_model(model_name, quantization_config) without return types