code: def get_automatic_label_weights(
      vocab_dict, label_counts, automatic_label_weighting_method
  ):
      """
      This function contains the logic on which automatic label weighting method to use based on the config. Label weights are automatically calculated from all training examples.
      Due to the fact that the label distribution can be highly skewed resulting in excessively weights, we implemented two normalization method, 'sqrt' and 'cap', to normalize the weights.
      """
      if (
          automatic_label_weighting_method
          == WeightingMethod.CLASS_RATIO
      ):
          automatic_label_weights = get_auto_label_weights(
              vocab_dict, label_counts
          )
      elif (
          automatic_label_weighting_method == WeightingMethod.SQRT_RATIO
      ):
          automatic_label_weights = get_normalized_sqrt_label_weights(
              vocab_dict, label_counts
          )
      elif (
          automatic_label_weighting_method
          == WeightingMethod.CAPPED_RATIO
      ):
          automatic_label_weights = get_normalized_cap_label_weights(
              vocab_dict, label_counts
          )
      else:
          raise ValueError(
              f"ERROR: weighting method {automatic_label_weighting_method} not recognized."
          )
  
      logging.info(
          f"automatic_label_weighting_method is {automatic_label_weighting_method} and label_weights is {automatic_label_weights}"
      )
      return automatic_label_weights
  
file_path: pytext/pytext/utils/label.py
imports: import logging
  from collections import Counter
  from typing import Dict
  import torch
  from pytext.utils.cuda import tensor
  from pytext.utils.typing import WeightingMethod
label_desc: Use image node_id 3 for calling a global function with example usage: get_automatic_label_weights(vocab_dict, label_counts, automatic_label_weighting_method) and returns: automatic_label_weights