def test_full_loop(tmpdir):
reset_seed()
dm = TrialMNISTDataModule(tmpdir)
model = EvalModelTemplate()
trainer = Trainer(
default_root_dir=tmpdir,
max_epochs=3,
weights_summary=None,
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
def test_trainer_attached_to_dm(tmpdir):
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