Skip to content

Commit

Permalink
fix indent bug in test_auto_unit (#507)
Browse files Browse the repository at this point in the history
Summary:
bypass-github-export-checks

Pull Request resolved: #507

# Context
I'm working to fix torchtnt pyre targets (coming up in next change) and discovered this bug

# This diff
Fix redundant indentation

Reviewed By: JKSenthil

Differential Revision: D48478812

fbshipit-source-id: 1dc2a28a3930331141ee9d96d9f479334eb4256f
  • Loading branch information
galrotem authored and facebook-github-bot committed Aug 19, 2023
1 parent 95f6944 commit 2bcc5ca
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions tests/framework/test_auto_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,25 +1095,25 @@ def on_train_step_end(
# train_step should not be in the timer's recorded_durations because it overlaps with other timings in the AutoUnit's train_step
tc.assertNotIn("TimingAutoUnit.train_step", recorded_timer_keys)

def on_eval_step_end(
self, state: State, data: Batch, step: int, loss: torch.Tensor, outputs: Any
) -> None:
if self.eval_progress.num_steps_completed_in_epoch == 1:
tc = unittest.TestCase()
recorded_timer_keys = state.timer.recorded_durations.keys()
for k in (
"TimingAutoUnit.on_eval_start",
"TimingAutoUnit.on_eval_epoch_start",
"evaluate.iter(dataloader)",
"evaluate.next(data_iter)",
"TimingAutoUnit.move_data_to_device",
"TimingAutoUnit.compute_loss",
"TimingAutoUnit.on_eval_step_end",
):
tc.assertIn(k, recorded_timer_keys)

# eval_step should not be in the timer's recorded_durations because it overlaps with other timings in the AutoUnit's eval_step
tc.assertNotIn("TimingAutoUnit.eval_step", recorded_timer_keys)
def on_eval_step_end(
self, state: State, data: Batch, step: int, loss: torch.Tensor, outputs: Any
) -> None:
if self.eval_progress.num_steps_completed_in_epoch == 1:
tc = unittest.TestCase()
recorded_timer_keys = state.timer.recorded_durations.keys()
for k in (
"TimingAutoUnit.on_eval_start",
"TimingAutoUnit.on_eval_epoch_start",
"evaluate.iter(dataloader)",
"evaluate.next(data_iter)",
"TimingAutoUnit.move_data_to_device",
"TimingAutoUnit.compute_loss",
"TimingAutoUnit.on_eval_step_end",
):
tc.assertIn(k, recorded_timer_keys)

# eval_step should not be in the timer's recorded_durations because it overlaps with other timings in the AutoUnit's eval_step
tc.assertNotIn("TimingAutoUnit.eval_step", recorded_timer_keys)


class TimingAutoPredictUnit(AutoPredictUnit[Batch]):
Expand Down

0 comments on commit 2bcc5ca

Please sign in to comment.