code: def _build_layer_specific_params(
      model: PreTrainedModel, base_lr: float, fine_tuning_arguments
  ):
      """Builds an iterable containing layer-specific parameter groups for use with a torch optimizer. These groups
      are separated by layer, by which we mean a logical grouping of neural network layers within the transformer
      as commonly used in literature (e.g., the embedding layer, multiple encoder layers,
      and a final classification layer).
  
      If enabled through the given `fine_tuning_arguments`, the layer-specific params are adapted so that
      layer-wise gradient decay and/or gradual unfreezing is performed.
  
      This function makes certain assumptions. For this functionality to work properly, a `PreTrainedModel` model
      with layers similar to `BertForSequenceClassification` is required.
      """
  
      layers = _collect_layer_specific_params(model)
      if fine_tuning_arguments.gradual_unfreezing >= len(layers):
          raise ValueError(
              "Invalid gradual unfreezing parameters: No trainable layers left."
          )
  
      params, start_layer = _adapt_layer_specific_params(
          layers, base_lr, fine_tuning_arguments
      )
  
      _check_for_completeness(model, layers, params, start_layer)
      return params
  
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 3 for calling a global function with example usage: _build_layer_specific_params(model, base_lr, fine_tuning_arguments) and returns: params