File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
tests/tests_pytorch/callbacks/progress Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -577,3 +577,31 @@ def test_rich_progress_bar_metrics_theme_update(*_):
577577 theme = RichProgressBar (theme = RichProgressBarTheme (metrics_format = ".3e" , metrics_text_delimiter = "\n " )).theme
578578 assert theme .metrics_format == ".3e"
579579 assert theme .metrics_text_delimiter == "\n "
580+
581+
582+ @RunIf (rich = True )
583+ def test_rich_progress_bar_empty_val_dataloader_model (tmp_path ):
584+ """Test that RichProgressBar doesn't crash with empty val_dataloader list from model."""
585+
586+ class EmptyListModel (BoringModel ):
587+ def train_dataloader (self ):
588+ return DataLoader (RandomDataset (32 , 64 ), batch_size = 2 )
589+
590+ def val_dataloader (self ):
591+ return []
592+
593+ model = EmptyListModel ()
594+ progress_bar = RichProgressBar ()
595+
596+ trainer = Trainer (
597+ default_root_dir = tmp_path ,
598+ max_epochs = 1 ,
599+ num_sanity_val_steps = 1 ,
600+ callbacks = [progress_bar ],
601+ limit_train_batches = 2 ,
602+ enable_checkpointing = False ,
603+ logger = False ,
604+ )
605+
606+ # This should not raise an AssertionError
607+ trainer .fit (model )
You can’t perform that action at this time.
0 commit comments