docstr: `Tensorflow` language model batch predictions for `AnchorText`.
  
  Parameters
  ----------
  x
      Batch of instances.
  vocab_size
      Vocabulary size of language model.
  batch_size
      Batch size used for predictions.
  
  Returns
  -------
  y
      Array with model predictions.
docstr_tok: ["`","Tensorflow","`","language","model","batch","predictions","for","`","AnchorText","`",".","Parameters","--","--","--","--","--","x","Batch","of","instances",".","vocab_size","Vocabulary","size","of","language","model",".","batch_size","Batch","size","used","for","predictions",".","Returns","--","--","--","-","y","Array","with","model","predictions","."]
code: def predict_batch_lm(
      self,
      x: transformers.tokenization_utils_base.BatchEncoding,
      vocab_size: int,
      batch_size: int,
  ) -> np.ndarray:
      """
      `Tensorflow` language model batch predictions for `AnchorText`.
  
      Parameters
      ----------
      x
          Batch of instances.
      vocab_size
          Vocabulary size of language model.
      batch_size
          Batch size used for predictions.
  
      Returns
      -------
      y
          Array with model predictions.
      """
      n, m = x["input_ids"].shape
      y = np.zeros((n, m, vocab_size), dtype=np.float32)
      n_minibatch = int(np.ceil(n / batch_size))
  
      for i in range(n_minibatch):
          istart, istop = i * batch_size, min((i + 1) * batch_size, n)
          x_batch = dict()
  
          if "input_ids" in x.keys():
              x_batch["input_ids"] = x["input_ids"][istart:istop]
  
          if "token_type_ids" in x.keys():
              x_batch["token_type_ids"] = x["token_type_ids"][
                  istart:istop
              ]
  
          if "attention_mask" in x.keys():
              x_batch["attention_mask"] = x["attention_mask"][
                  istart:istop
              ]
  
          y[istart:istop] = self.caller(**x_batch).logits.numpy()
      return y
  
imports: import abc
  import numpy
  from pathlib import Path
  from typing import Any, Callable, List, Optional, Tuple, Union
  import tensorflow
  import transformers
  from transformers import TFAutoModelForMaskedLM, AutoTokenizer
label_desc: Use image node_id 12 for calling the LanguageModel obj's underlying member method code with example usage: obj.predict_batch_lm(x, vocab_size, batch_size) and returns: y