code: def get_compress_methods(model, compress_methods, mpu=None):
      # extract the compression module for each method in compress_methods
      layer_added_compress_methods = []
      for method, method_content in compress_methods.items():
          if LAYER_REDUCTION in method:
              continue
          # for loop different methods, i.e., weight quantization, activation quantization etc
          exist_module_name = set()
          shared_parameters = method_content[
              SHARED_PARAMETERS
          ]  # get all the shared parameters
          for group_name, method_parameters in method_content[
              DIFFERENT_GROUPS
          ].items():
              # for loop different groups, i.e., weight quantization group 1, weight quantization group 2 etc
              module_name_list = []
              related_module_name_list = []
              if method_parameters[
                  DIFFERENT_GROUPS_RELATED_MODULE_SCOPE
              ]:
                  # this is used for head/row/channel pruning, if users provide the related module scope, we can shrink the layer dim for them
                  # otherwise we just mask those as zeros
                  for key_word, related_key_words in zip(
                      method_parameters[DIFFERENT_GROUPS_MODULE_SCOPE],
                      method_parameters[
                          DIFFERENT_GROUPS_RELATED_MODULE_SCOPE
                      ],
                  ):
                      module_name, exist_module_name = get_module_name(
                          group_name,
                          model,
                          key_word,
                          exist_module_name,
                          mpu=mpu,
                      )
                      module_name_list.append(module_name)
                      tmp_related_module_name_list = []
                      for rkw in related_key_words:
                          # related key word can be a list, for instance the QKV for O matrix in Attention
                          module_name, _ = get_module_name(
                              group_name, model, rkw, set(), mpu=mpu
                          )
                          tmp_related_module_name_list.append(
                              module_name
                          )
                      related_module_name_list.append(
                          tmp_related_module_name_list
                      )
              else:
                  for key_word in method_parameters[
                      DIFFERENT_GROUPS_MODULE_SCOPE
                  ]:
                      module_name, exist_module_name = get_module_name(
                          group_name,
                          model,
                          key_word,
                          exist_module_name,
                          mpu=mpu,
                      )
                      module_name_list.append(module_name)
  
              if module_name_list:
                  # combine shared parameters with each group
                  combined_method_parameters = {
                      **(
                          method_parameters.copy().pop(
                              DIFFERENT_GROUPS_PARAMETERS
                          )
                      ),
                      **shared_parameters,
                  }
                  compression_item = [
                      module_name_list,
                      related_module_name_list,
                      {method: combined_method_parameters},
                  ]
                  layer_added_compress_methods.append(compression_item)
      return layer_added_compress_methods
  
file_path: H2O/h2o_flexgen/benchmark/third_party/DeepSpeed/deepspeed/compression/compress.py
imports: import re
  from .helper import compression_preparation, fix_compression, recursive_getattr, is_module_compressible
  from .config import get_compression_config
  from ..runtime.config_utils import dict_raise_error_on_duplicate_keys
  from .constants import *
  import os
  import json
label_desc: Use image node_id 3 for calling a global function with example usage: get_compress_methods(model, compress_methods, mpu) and returns: layer_added_compress_methods