class_docstr: PyTorch implementation containing all the modelling needed for your NLP task. Combines a language
  model and a prediction head. Allows for gradient flow back to the language model component.
class_docstr_tok: ["PyTorch","implementation","containing","all","the","modelling","needed","for","your","NLP","task",".","Combines","a","language","model","and","a","prediction","head",".","Allows","for","gradient","flow","back","to","the","language","model","component","."]
docstr: Load a (downstream) model from huggingface's transformers format. Use cases:
   - continue training in FARM (e.g. take a squad QA model and fine-tune on your own data)
   - compare models without switching frameworks
   - use model directly for inference
  
  :param model_name_or_path: local path of a saved model or name of a public one.
                                        Exemplary public names:
                                        - distilbert-base-uncased-distilled-squad
                                        - deepset/bert-large-uncased-whole-word-masking-squad2
  
                                        See https://huggingface.co/models for full list
  :param revision: The version of model to use from the HuggingFace model hub. Can be tag name, branch name, or commit hash.
  :type revision: str
  :param device: "cpu" or "cuda"
  :param task_type: One of :
                    - 'question_answering'
                    - 'text_classification'
                    - 'embeddings'
                    More tasks coming soon ...
  :param processor: populates prediction head with information coming from tasks
  :type processor: Processor
  :return: AdaptiveModel
code: def convert_from_transformers(
      cls,
      model_name_or_path,
      device,
      revision=None,
      task_type=None,
      processor=None,
      **kwargs,
  ):
      """
      Load a (downstream) model from huggingface's transformers format. Use cases:
       - continue training in FARM (e.g. take a squad QA model and fine-tune on your own data)
       - compare models without switching frameworks
       - use model directly for inference
  
      :param model_name_or_path: local path of a saved model or name of a public one.
                                            Exemplary public names:
                                            - distilbert-base-uncased-distilled-squad
                                            - deepset/bert-large-uncased-whole-word-masking-squad2
  
                                            See https://huggingface.co/models for full list
      :param revision: The version of model to use from the HuggingFace model hub. Can be tag name, branch name, or commit hash.
      :type revision: str
      :param device: "cpu" or "cuda"
      :param task_type: One of :
                        - 'question_answering'
                        - 'text_classification'
                        - 'embeddings'
                        More tasks coming soon ...
      :param processor: populates prediction head with information coming from tasks
      :type processor: Processor
      :return: AdaptiveModel
      """
      return conv.Converter.convert_from_transformers(
          model_name_or_path,
          revision=revision,
          device=device,
          task_type=task_type,
          processor=processor,
          **kwargs,
      )
  
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 15 for calling the AdaptiveModel obj's underlying member method code with example usage: obj.convert_from_transformers(cls, model_name_or_path, device, revision, task_type, processor) and returns: conv