Skip to content

Commit

Permalink
[AutoParallel] fix reshard when train with eval (PaddlePaddle#46605)
Browse files Browse the repository at this point in the history
* [AutoParallel] fix reshard when train with eval

* fix mppp
  • Loading branch information
zhaoyinglia authored and zhaoyingli committed Oct 19, 2022
1 parent 20a74cb commit 4f80f64
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion python/paddle/distributed/auto_parallel/reshard.py
Original file line number Diff line number Diff line change
Expand Up @@ -1738,8 +1738,18 @@ def _remove_global_process_mesh(self):
if len(set(process_mesh.processes)) == len(processes):
global_process_mesh_idx = idx
break

if global_process_mesh_idx is not None:
self.dist_context.process_meshes.pop(idx)
is_removed = False
global_mesh = self.dist_context.process_meshes[idx]
for i, mesh in enumerate(self.dist_context.process_meshes):
if i == idx:
continue
if set(mesh.processes) < set(global_mesh.processes):
is_removed = True

if is_removed:
self.dist_context.process_meshes.pop(idx)

def _change_subblock_op_input_and_output(self, block_idx, block):
if "var_reshard_mapping" in Resharder.while_block_info[block_idx]:
Expand Down

0 comments on commit 4f80f64

Please sign in to comment.