class_docstr: Generic base class for the batched model.
  
  Subclass needs to implement predict_minibatch() and optionally
  max_minibatch_size().
docstr: Internal helper to predict using minibatches.
docstr_tok: ["Internal","helper","to","predict","using","minibatches","."]
code: def batched_predict(
      self, inputs: Iterable[JsonDict], **kw
  ) -> Iterator[JsonDict]:
      """Internal helper to predict using minibatches."""
      minibatch_size = self.max_minibatch_size(**kw)
      minibatch = []
      for ex in inputs:
          if len(minibatch) < minibatch_size:
              minibatch.append(ex)
          if len(minibatch) >= minibatch_size:
              yield from self.predict_minibatch(minibatch, **kw)
              minibatch = []
      if len(minibatch) > 0:  # pylint: disable=g-explicit-length-test
          yield from self.predict_minibatch(minibatch, **kw)
  
imports: import abc
  from collections.abc import Iterable, Iterator
  import inspect
  import itertools
  import multiprocessing
  from typing import Optional, Union
  from absl import logging
  from lit_nlp.api import dataset
  from lit_nlp.api import types
  from lit_nlp.lib import utils
  import numpy
label_desc: Use image node_id 5 for calling the BatchedModel obj's underlying member method code with example usage: obj.batched_predict(inputs) without return types