code: def _adapt_layer_specific_params(
      layers: List[dict], base_lr: float, fine_tuning_arguments
  ):
      layerwise_gradient_decay = (
          fine_tuning_arguments.layerwise_gradient_decay
      )
      use_gradual_unfreezing = (
          isinstance(fine_tuning_arguments.gradual_unfreezing, int)
          and fine_tuning_arguments.gradual_unfreezing > 0
      )
  
      total_layers = len(layers)
      start_layer = (
          0
          if not use_gradual_unfreezing
          else max(
              0, total_layers - fine_tuning_arguments.gradual_unfreezing
          )
      )
      num_layers = total_layers - start_layer
  
      params = []
      for i in range(start_layer, total_layers):
          lr = (
              base_lr
              if not layerwise_gradient_decay
              else base_lr
              * layerwise_gradient_decay
              ** (num_layers - (i + 1 - start_layer))
          )
          for sublayer in layers[i]:
              if (
                  sublayer.requires_grad
              ):  # Check whether frozen through pytorch interface
                  params.append({"params": sublayer, "lr": lr})
  
      return params, start_layer
  
file_path: small-text/small_text/integrations/transformers/utils/classification.py
imports: import os
  from typing import List
  from transformers import logging
  from transformers import AutoConfig, AutoModelForSequenceClassification, AutoTokenizer, PreTrainedModel
  from small_text.integrations.transformers.classifiers.base import ModelLoadingStrategy, PretrainedModelLoadingArguments
label_desc: Use image node_id 5 for calling a global function with example usage: _adapt_layer_specific_params(layers, base_lr, fine_tuning_arguments) and returns: params,  start_layer