docstr: Convert an adaptive model to huggingface's transformers format. Returns a list containing one model for each
  prediction head.
  
  :param adaptive_model: Model to convert.
  :type adaptive_model: AdaptiveModel
  :return: List of huggingface transformers models.
docstr_tok: ["Convert","an","adaptive","model","to","huggingface","'s","transformers","format",".","Returns","a","list","containing","one","model","for","each","prediction","head",".",":","param","adaptive_model",":","Model","to","convert",".",":","type","adaptive_model",":","AdaptiveModel",":","return",":","List","of","huggingface","transformers","models","."]
code: def convert_to_transformers(adaptive_model):
      """
      Convert an adaptive model to huggingface's transformers format. Returns a list containing one model for each
      prediction head.
  
      :param adaptive_model: Model to convert.
      :type adaptive_model: AdaptiveModel
      :return: List of huggingface transformers models.
      """
      if (
          len(adaptive_model.prediction_heads) == 2
          and adaptive_model.prediction_heads[0].model_type
          == "language_modelling"
      ):
          logger.warning(
              "Currently only the Masked Language Modeling component of the prediction head is converted, "
              "not the Next Sentence Prediction or Sentence Order Prediction components"
          )
  
      converted_models = []
  
      # convert model for each prediction head
      for prediction_head in adaptive_model.prediction_heads:
          if len(prediction_head.layer_dims) != 2:
              logger.error(
                  f"Currently conversion only works for PredictionHeads that are a single layer Feed Forward NN with dimensions [LM_output_dim, number_classes].\n"
                  f"            Your PredictionHead has {str(prediction_head.layer_dims)} dimensions."
              )
              continue
  
          if prediction_head.model_type in [
              "text_classification",
              "regression",
          ]:
              transformers_model = Converter._convert_to_transformers_classification_regression(
                  adaptive_model, prediction_head
              )
              converted_models.append(transformers_model)
  
          elif prediction_head.model_type == "span_classification":
              transformers_model = (
                  Converter._convert_to_transformers_qa(
                      adaptive_model, prediction_head
                  )
              )
              converted_models.append(transformers_model)
  
          elif prediction_head.model_type == "language_modelling":
              transformers_model = (
                  Converter._convert_to_transformers_lm(
                      adaptive_model, prediction_head
                  )
              )
              converted_models.append(transformers_model)
  
          elif prediction_head.model_type == "token_classification":
              transformers_model = (
                  Converter._convert_to_transformers_ner(
                      adaptive_model, prediction_head
                  )
              )
              converted_models.append(transformers_model)
  
          else:
              logger.error(
                  f"FARM -> Transformers conversion is not supported yet for"
                  f" prediction heads of type {prediction_head.model_type}"
              )
  
      return converted_models
  
file_path: FARM/farm/conversion/transformers.py
imports: import logging
  from transformers import AutoModelForSequenceClassification, AutoModelForQuestionAnswering, AutoModelWithLMHead, AutoModelForTokenClassification
  from farm.modeling import adaptive_model
  from farm.modeling.language_model import LanguageModel
  from farm.modeling.prediction_head import BertLMHead, QuestionAnsweringHead, RegressionHead, TextClassificationHead, TokenClassificationHead
label_desc: Use image node_id 1 for calling the Converter obj's underlying member method code with example usage: obj.convert_to_transformers(adaptive_model) and returns: converted_models