Skip to content

[mod] Sharding IO: Added DP-Meta gather for MoE #10847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: incubate/paddlenlp-fleety_20250421
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions paddlenlp/trainer/utils/reshard/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@ def merge_opt_state(opt_state_map):
def split_structure_name_mapping(structure_name_mapping, group_getter):
res = OrderedDict()
for k, v in structure_name_mapping.items():
if k not in group_getter.structure_name_mapping:
continue
group = group_getter.get_group(k)
if group.id not in res:
res[group.id] = OrderedDict()
Expand Down
4 changes: 4 additions & 0 deletions paddlenlp/trainer/utils/sharding_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,10 @@ def _gather_sharding_metas(self):
sharding_meta["param_meta_keys"] = ["shape", "dtype", "is_distributed", "no_sync"]
sharding_meta["sharding_strategy"] = sharding_strategy
sharding_meta["enable_overlap"] = pp_overlap
dp_metas_list = self._all_gather_simple_object(sharding_meta, self.hcg.get_data_parallel_group())
for e in dp_metas_list:
for key in ["structure_name_mapping", "param_meta"]:
sharding_meta[key].update(e[key])
suffix = self._sharding_meta_suffix()
sharding_metas[suffix] = sharding_meta
sharding_metas_list = self._all_gather_simple_object(sharding_metas, self.hcg.get_model_parallel_group())
Expand Down
Loading