Skip to content

Commit

Permalink
log epoch start and stop for bert (tinygrad#6912)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyuxyz authored Oct 6, 2024
1 parent b066ef2 commit 718b959
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/mlperf/model_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,12 @@ def train_bert():
else:
i, train_data = start_step, get_fake_data_bert(GPUS, BS)

epoch_started = False
while train_data is not None and i < train_steps and not achieved:
if not epoch_started and MLLOGGER and RUNMLPERF:
MLLOGGER.start(key=mllog_constants.EPOCH_START, value=i+1, metadata=dict(epoch_num=i+1))
epoch_started = True

Tensor.training = True
BEAM.value = TRAIN_BEAM
st = time.perf_counter()
Expand Down Expand Up @@ -801,6 +806,8 @@ def train_bert():
# ** eval loop **
if i % eval_step_freq == 0 or (BENCHMARK and i == BENCHMARK):
if MLLOGGER and RUNMLPERF:
epoch_started = False
MLLOGGER.event(key=mllog_constants.EPOCH_STOP, value=i+1, metadata=dict(epoch_num=i+1))
MLLOGGER.start(key=mllog_constants.EVAL_START, value=None, metadata={"epoch_num": 1, "epoch_count": 1, "step_num": i})
if getenv("RESET_STEP", 1): train_step_bert.reset()
eval_lm_losses = []
Expand Down

0 comments on commit 718b959

Please sign in to comment.