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: Initialize a multiprocessing.Pool for instances of Inferencer.
  
  :param num_processes: the number of processes for `multiprocessing.Pool`.
                        Set to value of 1 (or 0) to disable multiprocessing.
                        Set to None to let Inferencer use all CPU cores minus one.
                        If you want to debug the Language Model, you might need to disable multiprocessing!
                        **Warning!** If you use multiprocessing you have to close the
                        `multiprocessing.Pool` again! To do so call
                        :func:`~farm.infer.Inferencer.close_multiprocessing_pool` after you are
                        done using this class. The garbage collector will not do this for you!
  :type num_processes: int
  :return:
docstr_tok: ["Initialize","a","multiprocessing.Pool","for","instances","of","Inferencer",".",":","param","num_processes",":","the","number","of","processes","for","`","multiprocessing.Pool","`",".","Set","to","value","of","1","(","or","0",")","to","disable","multiprocessing",".","Set","to","None","to","let","Inferencer","use","all","CPU","cores","minus","one",".","If","you","want","to","debug","the","Language","Model",",","you","might","need","to","disable","multiprocessing","!","*","*","Warning","!","*","*","If","you","use","multiprocessing","you","have","to","close","the","`","multiprocessing.Pool","`","again","!","To","do","so","call",":","func",":","`","~farm.infer.Inferencer.close_multiprocessing_pool","`","after","you","are","done","using","this","class",".","The","garbage","collector","will","not","do","this","for","you","!",":","type","num_processes",":","int",":","return",":"]
code: def _set_multiprocessing_pool(self, num_processes):
      """
      Initialize a multiprocessing.Pool for instances of Inferencer.
  
      :param num_processes: the number of processes for `multiprocessing.Pool`.
                            Set to value of 1 (or 0) to disable multiprocessing.
                            Set to None to let Inferencer use all CPU cores minus one.
                            If you want to debug the Language Model, you might need to disable multiprocessing!
                            **Warning!** If you use multiprocessing you have to close the
                            `multiprocessing.Pool` again! To do so call
                            :func:`~farm.infer.Inferencer.close_multiprocessing_pool` after you are
                            done using this class. The garbage collector will not do this for you!
      :type num_processes: int
      :return:
      """
      self.process_pool = None
      if (
          num_processes == 0 or num_processes == 1
      ):  # disable multiprocessing
          self.process_pool = None
      else:
          if num_processes is None:  # use all CPU cores
              if mp.cpu_count() > 3:
                  num_processes = mp.cpu_count() - 1
              else:
                  num_processes = mp.cpu_count()
          self.process_pool = mp.Pool(processes=num_processes)
          logger.info(
              f"Got ya {num_processes} parallel workers to do inference ..."
          )
          log_ascii_workers(n=num_processes, logger=logger)
  
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 3 for calling the Inferencer obj's underlying member method code with example usage: obj._set_multiprocessing_pool(num_processes) without return types