add test for none checkpoint in ddp_spawn (#2845)

* add test for none checkpoint in ddp_spawn

* fix code style

* make sure checkpoint_callback is none

* Fix tests

Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
This commit is contained in:
s-rog 2020-08-06 19:11:43 +08:00 committed by GitHub
parent 767c44950c
commit 9b997c8616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -988,3 +988,17 @@ def test_trainer_setup_call(tmpdir):
trainer.test(ckpt_path=None)
assert trainer.stage == 'test'
assert trainer.get_model().stage == 'test'
def test_trainer_ddp_spawn_none_checkpoint(tmpdir):
model = EvalModelTemplate()
trainer = Trainer(
default_root_dir=tmpdir,
max_epochs=1,
checkpoint_callback=None,
distributed_backend="ddp_spawn"
)
assert trainer.checkpoint_callback is None
result = trainer.fit(model)
assert trainer.checkpoint_callback is None
assert result == 1