class_docstr: MetadataWriter to write the metadata into the text classifier.
class_docstr_tok: ["MetadataWriter","to","write","the","metadata","into","the","text","classifier","."]
docstr: Creates MetadataWriter for models with {Bert/SentencePiece}Tokenizer.
  
  `ids_name`, `mask_name`, and `segment_name` correspond to the `Tensor.name`
  in the TFLite schema, which help to determine the tensor order when
  populating metadata. The default values come from Model Maker.
  
  Args:
    model_buffer: valid buffer of the model file.
    tokenizer: information of the tokenizer used to process the input string,
      if any. Supported tokenziers are: `BertTokenizer` [1] and
      `SentencePieceTokenizer` [2]. If the tokenizer is `RegexTokenizer` [3],
      refer to `create_for_regex_model`.
    labels: an instance of Labels helper class used in the output
      classification tensor [4].
    ids_name: name of the ids tensor, which represents the tokenized ids of
      the input text.
    mask_name: name of the mask tensor, which represents the mask with `1` for
      real tokens and `0` for padding tokens.
    segment_name: name of the segment ids tensor, where `0` stands for the
      first sequence, and `1` stands for the second sequence if exists. [1]:
      https://github.com/google/mediapipe/blob/f8af41b1eb49ff4bdad756ff19d1d36f486be614/mediapipe/tasks/metadata/metadata_schema.fbs#L477
        [2]:
      https://github.com/google/mediapipe/blob/f8af41b1eb49ff4bdad756ff19d1d36f486be614/mediapipe/tasks/metadata/metadata_schema.fbs#L485
        [3]:
      https://github.com/google/mediapipe/blob/f8af41b1eb49ff4bdad756ff19d1d36f486be614/mediapipe/tasks/metadata/metadata_schema.fbs#L500
        [4]:
      https://github.com/google/mediapipe/blob/f8af41b1eb49ff4bdad756ff19d1d36f486be614/mediapipe/tasks/metadata/metadata_schema.fbs#L99
  
  Returns:
    A MetadataWriter object.
docstr_tok: ["Creates","MetadataWriter","for","models","with","{","Bert\/SentencePiece","}","Tokenizer",".","`","ids_name","`",",","`","mask_name","`",",","and","`","segment_name","`","correspond","to","the","`","Tensor.name","`","in","the","TFLite","schema",",","which","help","to","determine","the","tensor","order","when","populating","metadata",".","The","default","values","come","from","Model","Maker",".","Args",":","model_buffer",":","valid","buffer","of","the","model","file",".","tokenizer",":","information","of","the","tokenizer","used","to","process","the","input","string",",","if","any",".","Supported","tokenziers","are",":","`","BertTokenizer","`","[","1","]","and","`","SentencePieceTokenizer","`","[","2","]",".","If","the","tokenizer","is","`","RegexTokenizer","`","[","3","]",",","refer","to","`","create_for_regex_model","`",".","labels",":","an","instance","of","Labels","helper","class","used","in","the","output","classification","tensor","[","4","]",".","ids_name",":","name","of","the","ids","tensor",",","which","represents","the","tokenized","ids","of","the","input","text",".","mask_name",":","name","of","the","mask","tensor",",","which","represents","the","mask","with","`","1","`","for","real","tokens","and","`","0","`","for","padding","tokens",".","segment_name",":","name","of","the","segment","ids","tensor",",","where","`","0","`","stands","for","the","first","sequence",",","and","`","1","`","stands","for","the","second","sequence","if","exists",".","[","1","]",":","https",":","\/\/github.com\/google\/mediapipe\/blob\/f8af41b1eb49ff4bdad756ff19d1d36f486be614\/mediapipe\/tasks\/metadata\/metadata_schema.fbs","#","L477","[","2","]",":","https",":","\/\/github.com\/google\/mediapipe\/blob\/f8af41b1eb49ff4bdad756ff19d1d36f486be614\/mediapipe\/tasks\/metadata\/metadata_schema.fbs","#","L485","[","3","]",":","https",":","\/\/github.com\/google\/mediapipe\/blob\/f8af41b1eb49ff4bdad756ff19d1d36f486be614\/mediapipe\/tasks\/metadata\/metadata_schema.fbs","#","L500","[","4","]",":","https",":","\/\/github.com\/google\/mediapipe\/blob\/f8af41b1eb49ff4bdad756ff19d1d36f486be614\/mediapipe\/tasks\/metadata\/metadata_schema.fbs","#","L99","Returns",":","A","MetadataWriter","object","."]
code: def create_for_bert_model(
      cls,
      model_buffer: bytearray,
      tokenizer: Union[
          metadata_writer.BertTokenizer,
          metadata_writer.SentencePieceTokenizer,
      ],
      labels: metadata_writer.Labels,
      ids_name: str = _DEFAULT_ID_NAME,
      mask_name: str = _DEFAULT_MASK_NAME,
      segment_name: str = _DEFAULT_SEGMENT_ID_NAME,
  ) -> "MetadataWriter":
      """Creates MetadataWriter for models with {Bert/SentencePiece}Tokenizer.
  
      `ids_name`, `mask_name`, and `segment_name` correspond to the `Tensor.name`
      in the TFLite schema, which help to determine the tensor order when
      populating metadata. The default values come from Model Maker.
  
      Args:
        model_buffer: valid buffer of the model file.
        tokenizer: information of the tokenizer used to process the input string,
          if any. Supported tokenziers are: `BertTokenizer` [1] and
          `SentencePieceTokenizer` [2]. If the tokenizer is `RegexTokenizer` [3],
          refer to `create_for_regex_model`.
        labels: an instance of Labels helper class used in the output
          classification tensor [4].
        ids_name: name of the ids tensor, which represents the tokenized ids of
          the input text.
        mask_name: name of the mask tensor, which represents the mask with `1` for
          real tokens and `0` for padding tokens.
        segment_name: name of the segment ids tensor, where `0` stands for the
          first sequence, and `1` stands for the second sequence if exists. [1]:
          https://github.com/google/mediapipe/blob/f8af41b1eb49ff4bdad756ff19d1d36f486be614/mediapipe/tasks/metadata/metadata_schema.fbs#L477
            [2]:
          https://github.com/google/mediapipe/blob/f8af41b1eb49ff4bdad756ff19d1d36f486be614/mediapipe/tasks/metadata/metadata_schema.fbs#L485
            [3]:
          https://github.com/google/mediapipe/blob/f8af41b1eb49ff4bdad756ff19d1d36f486be614/mediapipe/tasks/metadata/metadata_schema.fbs#L500
            [4]:
          https://github.com/google/mediapipe/blob/f8af41b1eb49ff4bdad756ff19d1d36f486be614/mediapipe/tasks/metadata/metadata_schema.fbs#L99
  
      Returns:
        A MetadataWriter object.
      """
      writer = metadata_writer.MetadataWriter(model_buffer)
      writer.add_general_info(_MODEL_NAME, _MODEL_DESCRIPTION)
      writer.add_bert_text_input(
          tokenizer, ids_name, mask_name, segment_name
      )
      writer.add_classification_output(labels)
      return cls(writer)
  
imports: from typing import Union
  from mediapipe.tasks.python.metadata.metadata_writers import metadata_writer
label_desc: Use image node_id 2 for calling the MetadataWriter obj's underlying member method code with example usage: obj.create_for_bert_model(cls, model_buffer, tokenizer, labels, ids_name, mask_name, segment_name) and returns: cls