code: def convert_to_transformers():
      farm_input_dir = Path(
          "../saved_models/farm-bert-base-german-cased-hatespeech-GermEval18Coarse"
      )
      transformers_output_dir = "../saved_models/bert-base-german-cased-hatespeech-GermEval18Coarse"
      #
      # # # load from FARM format
      model = AdaptiveModel.load(farm_input_dir, device="cpu")
      processor = Processor.load_from_dir(farm_input_dir)
      model.connect_heads_with_processor(processor.tasks)
  
      # convert to transformers
      transformer_model = Converter.convert_to_transformers(model)[0]
      # # Alternative way to convert to transformers:
      # transformer_model = model.convert_to_transformers()[0]
  
      # save it (note: transformers use str instead of Path objects)
      Path(transformers_output_dir).mkdir(parents=True, exist_ok=True)
      transformer_model.save_pretrained(transformers_output_dir)
      processor.tokenizer.save_pretrained(transformers_output_dir)
  
      # run predictions (using transformers)
      nlp = pipeline(
          "sentiment-analysis",
          model=str(transformers_output_dir),
          tokenizer=str(transformers_output_dir),
      )
      res = nlp("Was ein scheiß Nazi!")
      pprint.pprint(res)
  
file_path: FARM/examples/conversion_huggingface_models_classification.py
imports: from farm.modeling.adaptive_model import AdaptiveModel
  from farm.conversion.transformers import Converter
  from farm.data_handler.processor import Processor
  from farm.infer import Inferencer
  import pprint
  from transformers.pipelines import pipeline
  from pathlib import Path
label_desc: Use image node_id 2 for calling a global function with example usage: convert_to_transformers() without return types