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: Run down-stream inference on samples created from an input file.
  The file should be in the same format as the ones used during training
  (e.g. squad style for QA, tsv for doc classification ...) as the same Processor will be used for conversion.
  
  :param file: path of the input file for Inference
  :type file: str
  :param multiprocessing_chunksize: number of dicts to put together in one chunk and feed to one process
  :type multiprocessing_chunksize: int
  :param streaming: return a Python generator object that yield results as they get computed, instead of
                    blocking for all the results. To use streaming, the dicts parameter must be a generator
                    and num_processes argument must be set. This mode can be useful to implement large scale
                    non-blocking inference pipelines.
  :type streaming: bool
  
  :return: an iterator(list or generator) of predictions
  :rtype: iter
docstr_tok: ["Run","down-stream","inference","on","samples","created","from","an","input","file",".","The","file","should","be","in","the","same","format","as","the","ones","used","during","training","(","e.g",".","squad","style","for","QA",",","tsv","for","doc","classification","...",")","as","the","same","Processor","will","be","used","for","conversion",".",":","param","file",":","path","of","the","input","file","for","Inference",":","type","file",":","str",":","param","multiprocessing_chunksize",":","number","of","dicts","to","put","together","in","one","chunk","and","feed","to","one","process",":","type","multiprocessing_chunksize",":","int",":","param","streaming",":","return","a","Python","generator","object","that","yield","results","as","they","get","computed",",","instead","of","blocking","for","all","the","results",".","To","use","streaming",",","the","dicts","parameter","must","be","a","generator","and","num_processes","argument","must","be","set",".","This","mode","can","be","useful","to","implement","large","scale","non-blocking","inference","pipelines",".",":","type","streaming",":","bool",":","return",":","an","iterator","(","list","or","generator",")","of","predictions",":","rtype",":","iter"]
code: def inference_from_file(
      self,
      file,
      multiprocessing_chunksize=None,
      streaming=False,
      return_json=True,
  ):
      """
      Run down-stream inference on samples created from an input file.
      The file should be in the same format as the ones used during training
      (e.g. squad style for QA, tsv for doc classification ...) as the same Processor will be used for conversion.
  
      :param file: path of the input file for Inference
      :type file: str
      :param multiprocessing_chunksize: number of dicts to put together in one chunk and feed to one process
      :type multiprocessing_chunksize: int
      :param streaming: return a Python generator object that yield results as they get computed, instead of
                        blocking for all the results. To use streaming, the dicts parameter must be a generator
                        and num_processes argument must be set. This mode can be useful to implement large scale
                        non-blocking inference pipelines.
      :type streaming: bool
  
      :return: an iterator(list or generator) of predictions
      :rtype: iter
      """
      dicts = self.processor.file_to_dicts(file)
      preds_all = self.inference_from_dicts(
          dicts,
          return_json=return_json,
          multiprocessing_chunksize=multiprocessing_chunksize,
          streaming=streaming,
      )
      if streaming:
          return preds_all
      else:
          return list(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 6 for calling the Inferencer obj's underlying member method code with example usage: obj.inference_from_file(file, multiprocessing_chunksize, streaming, return_json) and returns: preds_all, list