class_docstr: APIs to help create and train a BERT-based text classifier.
class_docstr_tok: ["APIs","to","help","create","and","train","a","BERT-based","text","classifier","."]
code: def _get_metadata_writer(
      self, tflite_model: bytearray, vocab_filepath: str
  ):
      return (
          text_classifier_writer.MetadataWriter.create_for_bert_model(
              model_buffer=tflite_model,
              tokenizer=metadata_writer.BertTokenizer(vocab_filepath),
              labels=metadata_writer.Labels().add(
                  list(self._label_names)
              ),
              ids_name=self._model_spec.tflite_input_name["ids"],
              mask_name=self._model_spec.tflite_input_name["mask"],
              segment_name=self._model_spec.tflite_input_name[
                  "segment_ids"
              ],
          )
      )
  
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 9 for calling the _BertClassifier obj's underlying member method code with example usage: obj._get_metadata_writer(tflite_model, vocab_filepath) and returns: text_classifier_writer