code: def test_batch_prediction(self):
      batch_inputs = [
          {
              "sentence": "It was the ending that I hated. I was disappointed that it was so bad."
          },
          {
              "sentence": "This one is honestly the worst movie I've ever watched."
          },
      ]
  
      archive = load_archive(
          self.FIXTURES_ROOT
          / "basic_classifier"
          / "serialization"
          / "model.tar.gz"
      )
      predictor = Predictor.from_archive(archive, "text_classifier")
      results = predictor.predict_batch_json(batch_inputs)
      assert len(results) == 2
  
      for result in results:
          logits = result.get("logits")
          assert logits is not None
          assert isinstance(logits, list)
          assert len(logits) == 2
          assert all(isinstance(x, float) for x in logits)
  
          probs = result.get("probs")
          assert probs is not None
          assert isinstance(probs, list)
          assert len(probs) == 2
          assert all(isinstance(x, float) for x in probs)
          assert all(x >= 0 for x in probs)
          assert sum(probs) == approx(1.0)
  
          label = result.get("label")
          assert label is not None
          assert (
              label
              in predictor._model.vocab.get_token_to_index_vocabulary(
                  namespace="labels"
              )
          )
  
          exps = [math.exp(x) for x in logits]
          sum_exps = sum(exps)
          for e, p in zip(exps, probs):
              assert e / sum_exps == approx(p)
  
file_path: allennlp/tests/predictors/text_classifier_test.py
imports: import math
  from pytest import approx
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.models.archival import load_archive
  from allennlp.predictors import Predictor
label_desc: Use image node_id 2 for calling the TestTextClassifierPredictor obj's underlying member method code with example usage: obj.test_batch_prediction() without return types