diff --git a/tests/tests_pytorch/trainer/logging_/test_train_loop_logging.py b/tests/tests_pytorch/trainer/logging_/test_train_loop_logging.py index 91511a7c17..e48f80d2d1 100644 --- a/tests/tests_pytorch/trainer/logging_/test_train_loop_logging.py +++ b/tests/tests_pytorch/trainer/logging_/test_train_loop_logging.py @@ -345,7 +345,7 @@ class LoggingSyncDistModel(BoringModel): @pytest.mark.parametrize( ("devices", "accelerator"), [ - # (1, "cpu"), + (1, "cpu"), (2, "cpu"), pytest.param(2, "gpu", marks=RunIf(min_cuda_gpus=2)), ], @@ -368,23 +368,23 @@ def test_logging_sync_dist_true(tmp_path, devices, accelerator): ) trainer.fit(model) - # total = fake_result * devices + 1 - # metrics = trainer.callback_metrics - # assert metrics["foo"] == total if use_multiple_devices else fake_result - # assert metrics["foo_2"] == 2 * devices - # assert metrics["foo_3"] == 2 - # assert metrics["foo_4"] == total / devices if use_multiple_devices else 1 - # assert metrics["foo_5"] == fake_result * 2 + 1 if use_multiple_devices else fake_result * 2 - # assert metrics["foo_6"] == (0 + 1 + 1 + 2 + 2 + 3) if use_multiple_devices else fake_result * 3 * 2 - # assert metrics["foo_7"] == 2 * devices * 3 - # assert metrics["foo_8"] == 2 - # assert metrics["foo_9"] == (fake_result * 2 + 1) / devices if use_multiple_devices else fake_result - # assert metrics["foo_10"] == 2 - # assert metrics["foo_11_step"] == (2 + 3) / 2 if use_multiple_devices else fake_result * 2 - # assert metrics["foo_11"] == (0 + 1 + 1 + 2 + 2 + 3) / (devices * 3) if use_multiple_devices else fake_result - # assert metrics["bar"] == fake_result * 3 * devices - # assert metrics["bar_2"] == fake_result - # assert metrics["bar_3"] == 2 + int(use_multiple_devices) + total = fake_result * devices + 1 + metrics = trainer.callback_metrics + assert metrics["foo"] == total if use_multiple_devices else fake_result + assert metrics["foo_2"] == 2 * devices + assert metrics["foo_3"] == 2 + assert metrics["foo_4"] == total / devices if use_multiple_devices else 1 + assert metrics["foo_5"] == fake_result * 2 + 1 if use_multiple_devices else fake_result * 2 + assert metrics["foo_6"] == (0 + 1 + 1 + 2 + 2 + 3) if use_multiple_devices else fake_result * 3 * 2 + assert metrics["foo_7"] == 2 * devices * 3 + assert metrics["foo_8"] == 2 + assert metrics["foo_9"] == (fake_result * 2 + 1) / devices if use_multiple_devices else fake_result + assert metrics["foo_10"] == 2 + assert metrics["foo_11_step"] == (2 + 3) / 2 if use_multiple_devices else fake_result * 2 + assert metrics["foo_11"] == (0 + 1 + 1 + 2 + 2 + 3) / (devices * 3) if use_multiple_devices else fake_result + assert metrics["bar"] == fake_result * 3 * devices + assert metrics["bar_2"] == fake_result + assert metrics["bar_3"] == 2 + int(use_multiple_devices) @RunIf(min_cuda_gpus=2, standalone=True)