def test_full_loop_dp(tmpdir):
reset_seed()
dm = TrialMNISTDataModule(tmpdir)
model = EvalModelTemplate()
trainer = Trainer(
default_root_dir=tmpdir,
max_epochs=3,
weights_summary=None,
accelerator="dp",
gpus=2,
deterministic=True,
)
// fit model
trainer.fit(model, dm)
assert trainer.state == TrainerState.FINISHED, f"Training failed with {trainer.state}"
// test
result = trainer.test(datamodule=dm)
result = result[0]
assert result["test_acc"] > 0.8
@pytest.mark.skipif(torch.cuda.device_count() < 1, reason="test requires multi-GPU machine")
After Change
// fit model
result = trainer.fit(model, dm)
assert trainer.state == TrainerState.FINISHED, f"Training failed with {trainer.state}"
assert result
// test
result = trainer.test(datamodule=dm)
// TODO: add end-to-end test