Skip to content

Commit d9b1ff3

Browse files
authored
fix tqdm standalone test (#12493)
1 parent 2230d59 commit d9b1ff3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tests/callbacks/test_tqdm_progress_bar.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -594,12 +594,14 @@ def test_progress_bar_max_val_check_interval(
594594
val_checks_per_epoch = total_train_batches / val_check_batch
595595
total_val_batches = total_val_samples // (val_batch_size * world_size)
596596
pbar_callback = trainer.progress_bar_callback
597-
assert pbar_callback.val_progress_bar.n == total_val_batches
598-
assert pbar_callback.val_progress_bar.total == total_val_batches
599-
total_val_batches = total_val_batches * val_checks_per_epoch
600-
assert pbar_callback.main_progress_bar.n == total_train_batches + total_val_batches
601-
assert pbar_callback.main_progress_bar.total == total_train_batches + total_val_batches
602-
assert pbar_callback.is_enabled == trainer.is_global_zero
597+
598+
if trainer.is_global_zero:
599+
assert pbar_callback.val_progress_bar.n == total_val_batches
600+
assert pbar_callback.val_progress_bar.total == total_val_batches
601+
total_val_batches = total_val_batches * val_checks_per_epoch
602+
assert pbar_callback.main_progress_bar.n == total_train_batches + total_val_batches
603+
assert pbar_callback.main_progress_bar.total == total_train_batches + total_val_batches
604+
assert pbar_callback.is_enabled
603605

604606

605607
def test_get_progress_bar_metrics(tmpdir: str):

0 commit comments

Comments
 (0)