Skip to content

Commit

Permalink
[refactor][PL][9/N] change the name of the _load_checkpoint to be mor…
Browse files Browse the repository at this point in the history
…e descriptive to contain test (#1030)

Summary: Pull Request resolved: #1030

Test Plan: Imported from OSS

Reviewed By: simran2905

Differential Revision: D29888294

Pulled By: ytsheng

fbshipit-source-id: 54919dc4e8448a1240b2cc72a364702aa7cf49c2
  • Loading branch information
Sasha Sheng authored and facebook-github-bot committed Sep 9, 2021
1 parent be5b032 commit 15fa630
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/trainers/lightning/test_checkpoint.py
Expand Up @@ -199,19 +199,19 @@ def _get_lightning_trainer(
class TestLightningCheckpoint(TestLightningCheckpoint):
def test_load_resume_parity_with_mmf(self):
# with checkpoint.resume = True, by default it loads "current.ckpt"
self._load_checkpoint("current.ckpt", ckpt_config={"resume": True})
self._load_checkpoint_and_test("current.ckpt", ckpt_config={"resume": True})

def test_load_resume_best_parity_with_mmf(self):
# with checkpoint.resume = True and checkpoint.resume_best = True
# by default it loads best.ckpt. It should load the "best.ckpt"
self._load_checkpoint(
self._load_checkpoint_and_test(
"best.ckpt", ckpt_config={"resume": True, "resume_best": True}
)

def test_load_resume_ignore_resume_zoo(self):
# specifying both checkpoint.resume = True and resume_zoo
# resume zoo should be ignored. It should load the "current.ckpt"
self._load_checkpoint(
self._load_checkpoint_and_test(
"current.ckpt",
ckpt_config={"resume": True, "resume_zoo": "visual_bert.pretrained.coco"},
)
Expand Down Expand Up @@ -474,7 +474,7 @@ def _get_mmf_ckpt(self, filename, ckpt_config=None):
)
return mmf_ckpt_current

def _load_checkpoint(self, filename, ckpt_config=None):
def _load_checkpoint_and_test(self, filename, ckpt_config=None):
# Make sure it loads x.ckpt when mmf
mmf_ckpt = self._get_mmf_ckpt(filename, ckpt_config=ckpt_config)

Expand Down

0 comments on commit 15fa630

Please sign in to comment.