class_docstr: Loads a saved AdaptiveModel/ONNXAdaptiveModel from disk and runs it in inference mode. Can be used for a
  model with prediction head (down-stream predictions) and without (using LM as embedder).
  
  Example usage:
  
  .. code-block:: python
  
     # down-stream inference
     basic_texts = [
         {"text": "Schartau sagte dem Tagesspiegel, dass Fischer ein Idiot sei"},
         {"text": "Martin Müller spielt Handball in Berlin"},
     ]
     model = Inferencer.load(your_model_dir)
     model.inference_from_dicts(dicts=basic_texts)
     # LM embeddings
     model = Inferencer.load(your_model_dir, extraction_strategy="cls_token", extraction_layer=-1)
     model.inference_from_dicts(dicts=basic_texts)
docstr: Implementation of inference from dicts without using Python multiprocessing. Useful for debugging or in API
  framework where spawning new processes could be expensive.
  
  :param dicts: Samples to run inference on provided as a list of dicts. One dict per sample.
  :type dicts: iter(dict)
  :param return_json: Whether the output should be in a json appropriate format. If False, it returns the prediction
                      object where applicable, else it returns PredObj.to_json()
  :type return_json: bool
  :param aggregate_preds: whether to aggregate predictions across different samples (e.g. for QA on long texts)
  :type aggregate_preds: bool
  
  :return: list of predictions
  :rtype: list
docstr_tok: ["Implementation","of","inference","from","dicts","without","using","Python","multiprocessing",".","Useful","for","debugging","or","in","API","framework","where","spawning","new","processes","could","be","expensive",".",":","param","dicts",":","Samples","to","run","inference","on","provided","as","a","list","of","dicts",".","One","dict","per","sample",".",":","type","dicts",":","iter","(","dict",")",":","param","return_json",":","Whether","the","output","should","be","in","a","json","appropriate","format",".","If","False",",","it","returns","the","prediction","object","where","applicable",",","else","it","returns","PredObj.to_json","(",")",":","type","return_json",":","bool",":","param","aggregate_preds",":","whether","to","aggregate","predictions","across","different","samples","(","e.g",".","for","QA","on","long","texts",")",":","type","aggregate_preds",":","bool",":","return",":","list","of","predictions",":","rtype",":","list"]
code: def _inference_without_multiprocessing(
      self, dicts, return_json, aggregate_preds
  ):
      """
      Implementation of inference from dicts without using Python multiprocessing. Useful for debugging or in API
      framework where spawning new processes could be expensive.
  
      :param dicts: Samples to run inference on provided as a list of dicts. One dict per sample.
      :type dicts: iter(dict)
      :param return_json: Whether the output should be in a json appropriate format. If False, it returns the prediction
                          object where applicable, else it returns PredObj.to_json()
      :type return_json: bool
      :param aggregate_preds: whether to aggregate predictions across different samples (e.g. for QA on long texts)
      :type aggregate_preds: bool
  
      :return: list of predictions
      :rtype: list
      """
      indices = list(range(len(dicts)))
      (
          dataset,
          tensor_names,
          problematic_ids,
          baskets,
      ) = self.processor.dataset_from_dicts(
          dicts, indices=indices, return_baskets=True
      )
      self.problematic_sample_ids = problematic_ids
      if self.benchmarking:
          self.benchmarker.record("dataset_single_proc")
  
      # TODO change format of formatted_preds in QA (list of dicts)
      if aggregate_preds:
          preds_all = self._get_predictions_and_aggregate(
              dataset, tensor_names, baskets
          )
      else:
          preds_all = self._get_predictions(
              dataset, tensor_names, baskets
          )
  
      if return_json:
          # TODO this try catch should be removed when all tasks return prediction objects
          try:
              preds_all = [x.to_json() for x in preds_all]
          except AttributeError:
              pass
  
      return preds_all
  
imports: import logging
  import multiprocessing
  import os
  from functools import partial
  import warnings
  import torch
  from torch.utils.data.sampler import SequentialSampler
  from tqdm import tqdm
  from typing import Generator, List, Union
  from farm.data_handler.dataloader import NamedDataLoader
  from farm.data_handler.processor import Processor, InferenceProcessor, NaturalQuestionsProcessor
  from farm.data_handler.utils import grouper
  from farm.data_handler.inputs import QAInput
  from farm.modeling.adaptive_model import AdaptiveModel, BaseAdaptiveModel, ONNXAdaptiveModel
  from farm.modeling.optimization import optimize_model
  from farm.utils import initialize_device_settings, MLFlowLogger
  from farm.utils import set_all_seeds, calc_chunksize, log_ascii_workers, Benchmarker
  from farm.modeling.predictions import QAPred
label_desc: Use image node_id 8 for calling the Inferencer obj's underlying member method code with example usage: obj._inference_without_multiprocessing(dicts, return_json, aggregate_preds) and returns: preds_all