Load fix (#74)

* skip weight load without callback

* added simple cpu test

* fixed pep
This commit is contained in:
William Falcon
2019-08-08 06:00:04 -04:00
committed by GitHub
parent a8abeaf50e
commit aa7245d9db
2 changed files with 37 additions and 0 deletions
+5
View File
@@ -259,6 +259,11 @@ class Trainer(TrainerIO):
last_epoch = -1
last_ckpt_name = None
# do nothing if there's not dir or callback
no_ckpt_callback = self.checkpoint_callback is None
if no_ckpt_callback or not os.path.exists(self.checkpoint_callback.filepath):
return
# find last epoch
checkpoints = os.listdir(self.checkpoint_callback.filepath)
for name in checkpoints:
+32
View File
@@ -26,6 +26,38 @@ np.random.seed(SEED)
# ------------------------------------------------------------------------
# TESTS
# ------------------------------------------------------------------------
def test_simple_cpu():
"""
Verify continue training session on CPU
:return:
"""
hparams = get_hparams()
model = LightningTestModel(hparams)
save_dir = init_save_dir()
# exp file to get meta
test_exp_version = 10
exp = get_exp(False, version=test_exp_version)
exp.argparse(hparams)
exp.save()
trainer_options = dict(
max_nb_epochs=1,
val_percent_check=0.1,
train_percent_check=0.1,
experiment=exp,
)
# fit model
trainer = Trainer(**trainer_options)
result = trainer.fit(model)
# traning complete
assert result == 1, 'amp + ddp model failed to complete'
clear_save_dir()
def test_amp_single_gpu():
"""