Skip to content

Commit

Permalink
Added the explanation of DS_REMOVED_COMMON_REDUCE_LINEAR_KEYS
Browse files Browse the repository at this point in the history
  • Loading branch information
gyou2021 committed Jan 20, 2025
1 parent 5f91466 commit 86195c8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion deepspeed/module_inject/auto_tp.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def tp_parser(model):
'dense_4h_to_h': 'ChatGLM'
}
ds_reduceLinear_items = predefined_ds_common_reduceLinear_items
#DS_ALL_REDUCE_LINEAR_ITEMS is a dictionary whose keys are layer names of LinearAllreduce and
#'DS_ALL_REDUCE_LINEAR_ITEMS' is a dictionary whose keys are layer names of LinearAllreduce and
#whose values are keywords in the module name.
# If the same layer name in multiple models is LinearAllreduce, concat the keywords of the different module names with comma
# import os
Expand All @@ -317,6 +317,10 @@ def tp_parser(model):

ds_reduceLinear_keys = ds_reduceLinear_items.keys()

#'DS_REMOVED_COMMON_REDUCE_LINEAR_KEYS' is a list. The layer name in the list will be removed from those of default common LinearAllReduce.
# import os
# os.environ["DS_ALL_REDUCE_LINEAR_ITEMS"] = "['layer_name_1', 'layer_name_2',...]"
#for example: os.environ["DS_ALL_REDUCE_LINEAR_ITEMS"] = "['o_proj']"
ds_user_remove_reduceLinear_keys = os.environ.get('DS_REMOVED_COMMON_REDUCE_LINEAR_KEYS')
if ds_user_remove_reduceLinear_keys:
ds_user_remove_reduceLinear_keys = ast.literal_eval(ds_user_remove_reduceLinear_keys)
Expand Down

0 comments on commit 86195c8

Please # to comment.