class_docstr: Implementation of ONNX Runtime for Inference of ONNX Models.
  
  Existing PyTorch based FARM AdaptiveModel can be converted to ONNX format using AdaptiveModel.convert_to_onnx().
  The conversion is currently only implemented for Question Answering Models.
  
  For inference, this class is compatible with the FARM Inferencer.
class_docstr_tok: ["Implementation","of","ONNX","Runtime","for","Inference","of","ONNX","Models",".","Existing","PyTorch","based","FARM","AdaptiveModel","can","be","converted","to","ONNX","format","using","AdaptiveModel.convert_to_onnx","(",")",".","The","conversion","is","currently","only","implemented","for","Question","Answering","Models",".","For","inference",",","this","class","is","compatible","with","the","FARM","Inferencer","."]
code: def __init__(
      self,
      onnx_session,
      language_model_class,
      language,
      prediction_heads,
      device,
  ):
      import onnxruntime
  
      if str(device) == "cuda" and onnxruntime.get_device() != "GPU":
          raise Exception(
              f"Device {device} not available for Inference. For CPU, run pip install onnxruntime and"
              f"for GPU run pip install onnxruntime-gpu"
          )
      self.onnx_session = onnx_session
      self.language_model_class = language_model_class
      self.language = language
      self.prediction_heads = prediction_heads
      self.device = device
  
imports: import copy
  import json
  import logging
  import os
  from pathlib import Path
  import multiprocessing
  import numpy
  import torch
  from torch import nn
  from transformers import AutoConfig
  from transformers.convert_graph_to_onnx import convert, quantize
  from farm.data_handler.processor import Processor
  from farm.modeling.language_model import LanguageModel
  from farm.modeling.prediction_head import PredictionHead, pick_single_fn
  from farm.utils import MLFlowLogger, stack
  import farm.conversion.transformers
label_desc: Use image node_id 1 to create a new ONNXAdaptiveModel object from inherited base classes: BaseAdaptiveModel with example: obj = ONNXAdaptiveModel(onnx_session, language_model_class, language, prediction_heads, device)