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:
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: 906e15cfc56115033c2696a693e7d6952f5370b1
  • Loading branch information
galrotem authored and facebook-github-bot committed Aug 18, 2023
1 parent 95f6944 commit f7f5664
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 (

Check warning on line 1104 in tests/framework/test_auto_unit.py

View check run for this annotation

Codecov / codecov/patch

tests/framework/test_auto_unit.py#L1102-L1104

Added lines #L1102 - L1104 were not covered by tests
"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)

Check warning on line 1113 in tests/framework/test_auto_unit.py

View check run for this annotation

Codecov / codecov/patch

tests/framework/test_auto_unit.py#L1113

Added line #L1113 was not covered by tests

# 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)

Check warning on line 1116 in tests/framework/test_auto_unit.py

View check run for this annotation

Codecov / codecov/patch

tests/framework/test_auto_unit.py#L1116

Added line #L1116 was not covered by tests


class TimingAutoPredictUnit(AutoPredictUnit[Batch]):
Expand Down

0 comments on commit f7f5664

Please sign in to comment.