code: def get_class_weight(class_weight):
      """Get class weight for loss function.
  
      Args:
          class_weight (list[float] | str | None): If class_weight is a str,
              take it as a file name and read from it.
      """
      if isinstance(class_weight, str):
          # take it as a file path
          if class_weight.endswith(".npy"):
              class_weight = np.load(class_weight)
          else:
              # pkl, json or yaml
              class_weight = mmcv.load(class_weight)
  
      return class_weight
  
file_path: lavis/lavis/common/annotator/uniformer/mmseg/models/losses/utils.py
imports: import functools
  import annotator.uniformer.mmcv
  import numpy
  import torch.nn.functional
label_desc: Use image node_id 1 for calling a global function with example usage: get_class_weight(class_weight) and returns: class_weight