Skip to content

Commit

Permalink
[Trainer] update trainer.py for seed resume (PaddlePaddle#9656)
Browse files Browse the repository at this point in the history
  • Loading branch information
DesmonDay authored and zhangyuqin1998 committed Dec 23, 2024
1 parent 0f5d458 commit 0d4271c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions paddlenlp/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1904,9 +1904,14 @@ def _load_rng_state(self, checkpoint):
if "hybrid_parallel_rng_state_tracker" in checkpoint_rng_state:
if self.args.tensor_parallel_degree <= 1:
checkpoint_rng_state["hybrid_parallel_rng_state_tracker"].pop("model_parallel_rng", None)
fleet.meta_parallel.get_rng_state_tracker().set_states_tracker(
checkpoint_rng_state["hybrid_parallel_rng_state_tracker"]
)
try:
fleet.meta_parallel.get_rng_state_tracker().set_states_tracker(
checkpoint_rng_state["hybrid_parallel_rng_state_tracker"]
)
except:
logger.warning(
"Hybrid paralell rng states change when training environment differs, so we dot not set state tracker here."
)
else:
logger.warning("Not found hybrid parallel RNG state.")

Expand Down

0 comments on commit 0d4271c

Please sign in to comment.