code: def get_adaptive_model(
      lm_output_type,
      prediction_heads,
      layer_dims,
      model,
      device,
      embeds_dropout_prob,
      class_weights=None,
  ):
      parsed_lm_output_types = lm_output_type.split(",")
      language_model = LanguageModel.load(model)
  
      initialized_heads = []
      for head_name in prediction_heads.split(","):
          initialized_heads.append(
              PredictionHead.create(
                  prediction_head_name=head_name,
                  layer_dims=layer_dims,
                  class_weights=class_weights,
              )
          )
  
      model = AdaptiveModel(
          language_model=language_model,
          prediction_heads=initialized_heads,
          embeds_dropout_prob=embeds_dropout_prob,
          lm_output_types=parsed_lm_output_types,
          device=device,
      )
      return model
  
file_path: FARM/farm/experiment.py
imports: import logging
  from pathlib import Path
  from farm.data_handler.data_silo import DataSilo
  from farm.modeling.adaptive_model import AdaptiveModel
  from farm.modeling.language_model import LanguageModel
  from farm.modeling.optimization import initialize_optimizer
  from farm.modeling.prediction_head import PredictionHead
  from farm.modeling.tokenization import Tokenizer
  from farm.data_handler.processor import Processor
  from farm.train import Trainer, EarlyStopping
  from farm.utils import set_all_seeds, initialize_device_settings
  from farm.utils import MLFlowLogger
  from farm.file_utils import read_config, unnestConfig
label_desc: Use image node_id 3 for calling a global function with example usage: get_adaptive_model(lm_output_type, prediction_heads, layer_dims, model, device, embeds_dropout_prob, class_weights) and returns: model