Skip to content

Commit

Permalink
Add debugging log statements to simulation runner.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 389967310
  • Loading branch information
ZacharyGarrett authored and tensorflow-copybara committed Aug 10, 2021
1 parent a1235c9 commit 44bf540
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tensorflow_federated/python/simulation/training_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,17 +346,20 @@ def run_simulation_with_callbacks(
(potentially updated) mapping of metrics.
Returns:
The `state` of the iterative process after training.
The `state` of the iterative process after trainingjj.
"""
logging.debug('Initializing simulation process')
initial_state = process.initialize()

if on_loop_start is not None:
logging.debug('call loop start callback')
state, start_round = on_loop_start(initial_state)
else:
state = initial_state
start_round = 1

for round_num in range(start_round, total_rounds + 1):
logging.debug('Executing round %d', round_num)
round_metrics = collections.OrderedDict(round_num=round_num)

train_start_time = time.time()
Expand All @@ -372,6 +375,7 @@ def run_simulation_with_callbacks(
round_metrics.update(metrics)

if on_round_end is not None:
logging.info('running round end callback')
state, round_metrics = on_round_end(state, round_num, round_metrics)

logging.info('Output metrics at round {:d}:\n{!s}'.format(
Expand Down

0 comments on commit 44bf540

Please sign in to comment.