class_docstr: Wrapper for a Huggingface Transformers GPT-2 model.
  
  This class loads a tokenizer and model using the Huggingface library and
  provides the LIT-required functions plus additional helper functions to
  convert and clean tokens and to compute the top_k predictions from logits.
class_docstr_tok: ["Wrapper","for","a","Huggingface","Transformers","GPT-2","model",".","This","class","loads","a","tokenizer","and","model","using","the","Huggingface","library","and","provides","the","LIT-required","functions","plus","additional","helper","functions","to","convert","and","clean","tokens","and","to","compute","the","top_k","predictions","from","logits","."]
docstr: Predict on a single minibatch of examples.
docstr_tok: ["Predict","on","a","single","minibatch","of","examples","."]
code: def predict_minibatch(self, inputs):
      """Predict on a single minibatch of examples."""
      # Preprocess inputs.
      texts = [ex["text"] for ex in inputs]
      encoded_inputs = self.tokenizer.batch_encode_plus(
          texts,
          return_tensors="tf",
          add_special_tokens=True,
          padding="longest",
          truncation="longest_first",
      )
  
      # Get the predictions.
      batched_outputs = self._pred(encoded_inputs)
      # Convert to numpy for post-processing.
      detached_outputs = {
          k: v.numpy() for k, v in batched_outputs.items()
      }
      # Split up batched outputs, then post-process each example.
      unbatched_outputs = utils.unbatch_preds(detached_outputs)
      return map(self._postprocess, unbatched_outputs)
  
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 9 for calling the GPT2LanguageModel obj's underlying member method code with example usage: obj.predict_minibatch(inputs) and returns: map