Skip to content

Commit 87515b4

Browse files
Support param and moment sync for pp (#11046)
1 parent 9c3ae1d commit 87515b4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

paddlenlp/trainer/training_args.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,8 @@ def __post_init__(self):
12351235
"use_dualpipev",
12361236
"forward_backward_overlap_scheduler",
12371237
"enable_dynamic_shape",
1238+
"sync_moment",
1239+
"sync_param",
12381240
]:
12391241
raise ValueError(
12401242
f"Found unknown pipeline mode config {x}, accept config is disable_p2p_cache_shape, disable_partial_send_recv."
@@ -1287,6 +1289,18 @@ def __post_init__(self):
12871289
in pipeline_parallel_config,
12881290
"enable_dynamic_shape": "enable_dynamic_shape" in pipeline_parallel_config,
12891291
}
1292+
1293+
pp_sync_param = "sync_param" in pipeline_parallel_config
1294+
pp_sync_moment = "sync_moment" in pipeline_parallel_config
1295+
1296+
if pp_sync_param:
1297+
logger.info("setting pp sync_param")
1298+
strategy.hybrid_configs["pp_configs"].sync_param = True
1299+
1300+
if pp_sync_moment:
1301+
logger.info("setting pp sync_moment")
1302+
strategy.hybrid_configs["pp_configs"].sync_moment = True
1303+
12901304
if dygraph_pp_configs["dp_comm_overlap"]:
12911305
raise ValueError("overlap has accuracy issue") # TODO: fix `overalap` + `delay_scale` issue
12921306

0 commit comments

Comments
 (0)