class_docstr: BERT masked LM using Huggingface Transformers and TensorFlow 2.
class_docstr_tok: ["BERT","masked","LM","using","Huggingface","Transformers","and","TensorFlow","2","."]
docstr: Postprocess, modifying output dict in-place.
docstr_tok: ["Postprocess",",","modifying","output","dict","in-place","."]
code: def _postprocess(self, output: dict[str, np.ndarray]):
      """Postprocess, modifying output dict in-place."""
      # Slice to remove padding, omitting initial [CLS] and final [SEP]
      slicer = slice(1, output.pop("ntok") - 1)
      output["tokens"] = self.tokenizer.convert_ids_to_tokens(
          output.pop("input_ids")[slicer]
      )
      probas = output.pop("probas")
  
      # Predictions at every position, regardless of masking.
      output["pred_tokens"] = self._get_topk_tokens(
          probas[slicer]
      )  # pytype: disable=container-type-mismatch
  
      return output
  
imports: import re
  from lit_nlp.api import model
  from lit_nlp.api import types
  from lit_nlp.examples.models import model_utils
  from lit_nlp.lib import file_cache
  from lit_nlp.lib import utils
  import numpy
  import tensorflow
  import transformers
label_desc: Use image node_id 5 for calling the BertMLM obj's underlying member method code with example usage: obj._postprocess(output) and returns: output