2626from torch .utils .data import DataLoader
2727from torchmetrics import Accuracy
2828
29- from pytorch_lightning import LightningDataModule , LightningModule , seed_everything , Trainer
29+ from pytorch_lightning import LightningDataModule , LightningModule , Trainer
3030from pytorch_lightning .callbacks import Callback , LearningRateMonitor , ModelCheckpoint
3131from pytorch_lightning .demos .boring_classes import BoringModel , RandomDataset
3232from pytorch_lightning .plugins import DeepSpeedPrecisionPlugin
@@ -712,7 +712,6 @@ def test_deepspeed_multigpu_stage_3_manual_optimization(tmpdir, deepspeed_config
712712@pytest .mark .parametrize (("accumulate_grad_batches" , "automatic_optimization" ), [(1 , False ), (2 , True )])
713713@RunIf (min_cuda_gpus = 2 , standalone = True , deepspeed = True )
714714def test_deepspeed_multigpu_stage_3_checkpointing (tmpdir , automatic_optimization , accumulate_grad_batches ):
715- seed_everything (1 )
716715 if automatic_optimization :
717716 model = ModelParallelClassificationModel ()
718717 else :
@@ -734,9 +733,7 @@ def test_deepspeed_multigpu_stage_3_checkpointing(tmpdir, automatic_optimization
734733 trainer .fit (model , datamodule = dm )
735734
736735 results = trainer .test (datamodule = dm )
737- assert results [0 ]["test_acc" ] > 0.7
738736 saved_results = trainer .test (ckpt_path = ck .best_model_path , datamodule = dm )
739- assert saved_results [0 ]["test_acc" ] > 0.7
740737 assert saved_results == results
741738
742739 if automatic_optimization :
@@ -752,9 +749,7 @@ def test_deepspeed_multigpu_stage_3_checkpointing(tmpdir, automatic_optimization
752749 enable_progress_bar = False ,
753750 enable_model_summary = False ,
754751 )
755-
756- results = trainer .test (model , datamodule = dm , ckpt_path = ck .best_model_path )
757- assert results [0 ]["test_acc" ] > 0.7
752+ trainer .test (model , datamodule = dm , ckpt_path = ck .best_model_path )
758753
759754
760755@RunIf (min_cuda_gpus = 1 , standalone = True , deepspeed = True )
@@ -861,7 +856,6 @@ def on_train_epoch_start(self, trainer: Trainer, pl_module: LightningModule) ->
861856@RunIf (min_cuda_gpus = 2 , standalone = True , deepspeed = True )
862857def test_deepspeed_multigpu_stage_2_accumulated_grad_batches (tmpdir , offload_optimizer ):
863858 """Test to ensure with Stage 2 and multiple GPUs, accumulated grad batches works."""
864- seed_everything (42 )
865859
866860 class VerificationCallback (Callback ):
867861 def __init__ (self ):
@@ -1109,7 +1103,7 @@ def test_dataloader(self):
11091103@pytest .mark .parametrize ("max_epoch" , [2 ])
11101104@pytest .mark .parametrize ("limit_train_batches" , [2 ])
11111105@RunIf (min_cuda_gpus = 1 , standalone = True , deepspeed = True )
1112- def test_scheduler_step_count (mock_step , max_epoch , limit_train_batches , interval ):
1106+ def test_scheduler_step_count (mock_step , tmpdir , max_epoch , limit_train_batches , interval ):
11131107 """Test to ensure that the scheduler is called the correct amount of times during training when scheduler is
11141108 set to step or epoch."""
11151109
@@ -1124,7 +1118,7 @@ def configure_optimizers(self):
11241118
11251119 model = TestModel ()
11261120 trainer = Trainer (
1127- default_root_dir = os . getcwd () ,
1121+ default_root_dir = tmpdir ,
11281122 limit_train_batches = limit_train_batches ,
11291123 limit_val_batches = 0 ,
11301124 max_epochs = max_epoch ,
0 commit comments