Skip to content
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

[for test]Apex grabs the entire global_step #9265

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
14 changes: 14 additions & 0 deletions paddlenlp/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
# This file is modified from
# https:/huggingface/transformers/blob/main/src/transformers/trainer.py

#####################################
from paddleapex import Tracer
checker = Tracer()
#####################################

import collections
import contextlib
import inspect
Expand Down Expand Up @@ -956,6 +961,11 @@ def _inner_training_loop(

step = -1
for step, inputs in enumerate(epoch_iterator):

#####################################
checker.start_in_training(step, self.args.gradient_accumulation_steps)
#####################################

if self.args.use_hybrid_parallel and self.args.sep_parallel_degree > 1:
inputs = split_inputs_sequence_dim(inputs)
if self.args.use_hybrid_parallel and self.args.context_parallel_degree > 1:
Expand Down Expand Up @@ -1191,6 +1201,10 @@ def fused_allreduce_gradients_no_sync(paramlist, hcg):
if self.args.ignore_data_skip:
self.timers and self.timers("read-data").start()

#####################################
checker.stop_in_training()
#####################################

if step < 0:
logger.warning(
f"There seems to be not a single sample in your epoch_iterator, stopping training at step"
Expand Down
Loading