Skip to content

Commit

Permalink
don't pass tpu weights back on test (#2566)
Browse files Browse the repository at this point in the history
* enable none checkpoint

* enable none checkpoint
  • Loading branch information
williamFalcon authored Jul 9, 2020
1 parent 6f4a488 commit b738126
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pytorch_lightning/trainer/distrib_parts.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def tpu_train(self, tpu_core_idx, model):
self.run_pretrain_routine(model)

# when training ends on these platforms dump weights to get out of the main process
if self.on_colab_kaggle:
if self.on_colab_kaggle and not self.testing:
rank_zero_warn('cleaning up... please do not interrupt')
self.save_spawn_weights(model)

Expand Down
2 changes: 1 addition & 1 deletion pytorch_lightning/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ def fit(
xmp.spawn(self.tpu_train, args=(model,), nprocs=self.tpu_cores, start_method=start_method)

# load weights if not interrupted
if self.on_colab_kaggle:
if self.on_colab_kaggle and not self.testing:
self.load_spawn_weights(model)

self.model = model
Expand Down
4 changes: 3 additions & 1 deletion tests/callbacks/test_model_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

@pytest.mark.parametrize('save_top_k', [-1, 0, 1, 2])
def test_model_checkpoint_with_non_string_input(tmpdir, save_top_k):
""" Test that None in checkpoint callback is valid and that chkp_path is set correctly """
"""
Test that None in checkpoint callback is valid and that chkp_path is set correctly
"""
tutils.reset_seed()
model = EvalModelTemplate()

Expand Down

0 comments on commit b738126

Please sign in to comment.